Instructions for Compiling the OneWireViewer for Linux

By: Wilson Tang

Abstract: This guide shows how to compile and run the OneWireViewer under Linux.

This guide shows how to compile and run the OneWireViewer under Linux®. The OneWireViewer is a software program to exercise Maxim Integrated's 1-Wire® and iButton® devices. These instructions were tested for Ubuntu Linux.

Download the zip file. Open a terminal window and unzip the contents by:

$ unzip

First, build the PDKAdapterUSB Java® class for the OneWireViewer using Java Native Interface (JNI). This uses the DS2490 adapter with libusb and is based on the 1-Wire Public Domain Kit (PDK). The libusb development headers and build-essentials (compiler/build tools) can be installed by:

$ sudo apt-get install libusb-dev build-essential

The make file assumes that the installed Java version is the OpenJDK version. The make file uses the header files from JDK (Java Development Kit). Install the library and header files via:

$ sudo apt-get install openjdk-7-jdk

If a different Java version is used, you may need to modify the make file to include a path for the Java header files for the targeted Java version. OpenJDK is the default Java version in Ubuntu.

Next, compile the Java class, and install the system shared library:

$ cd OneWireViewer-Linux/PDKAdapterUSB
$ make
$ sudo make install

This will install the shared JNI library to /usr/local/lib.

The included OneWireAPI's OneWireAccessProvider has already been modified to include the PDKApapterUSB.

You should not plug in the DS9490 until the following sections of instructions are completed. By default, the kernel modules ds2490 and wire are loaded when the device is plugged in, but in our case we would like to access the DS9490R via libusb. You should modify the black list file to prevent this from occurring:

$ sudo gedit /etc/modprobe.d/blacklist.conf

Add a line to the bottom,

# Prevent ds2490 module from loading for OneWireViewer with libusb 
blacklist ds2490

To automatically set the correct permissions, create a new udev rule file to set the permissions. The DS9490 will be set to allow read and write to users in the plugdev group.

$ sudo gedit /etc/udev/rules.d/99-one-wire.rules

with the contents:

ATTRS{idVendor}=="04fa", ATTRS{idProduct}=="2490", GROUP="plugdev", MODE="0664"

Now, you may plug in the DS9490 and run OneWireViewer:

$ cd ..
$ cd OneWireViewer
$ bash

The script sets the Java classpath and library path for JNI. When the "1-Wire API for Java Setup Wizard" appears, select "USB1" for the port.

1-Wire API for Java Setup Wizard. Figure 1. 1-Wire API for Java Setup Wizard.