Aim : List the usb devicse via java progran at Linux.

Below is the information I got :
1. The book I studied is "O' Reilly Java I/O 2nd edition" and the chapter23.

2. Meanwhile I also surfed and read the "JRS-80" (http://javax-usb.org)

Below is the configuration I set :
a. Put the *jsr80-1.0.0.jar*、*jsr80_linux-1.0.1.jar*、*jsr80_ri-1.0.0.jar*into
the directory "/
*jdk/jre/lib/ext*/"
b. Rename the *libJavaxUsb-1.0.0.so* to* libJavaxUsb.so*. And place it to
the directory *"/jdk/jre/lib/i386*/"
c. Place* javax-usb.properties* to the "*/jdk/jre/lib/*"
d. I have used the different Linux platform (OpenSuSe and 10, RedHat
EnterPrise 5, Debian, Fedora...etc)
e. I also tried the different version about JDK (jdk-6-linux-i586.bin,
Java5, J2SDK)

Below is the code I tried :
import java.util.*;
import javax.usb.*;
public class USBLister{
  public static void main(String args[]) throws UsbException{
    UsbServices services = UsbHostManager.getUsbServices();
    UsbHub root = services.getRootUsbHub();
    listDevices(root);
  }
  public static void listDevices(UsbHub hub){
    List devices = hub.getAttachedUsbDevices();
    Iterator iterator = devices.iterator();
    while(iterator.hasNext()){
      UsbDevice device = (UsbDevice)iterator.next();
      System.out.println(device);
      if(device.isUsbHub()){
        listDevices((UsbHub)device);
      }
    }
  }
}

==> Everything is okay about the compile (javac).
==> But when I ran (java) it, some exception occured.
Exception : com.ibm.jusb.os.linux.JavaxUsb.nativeSetTraceOutput
==> I am confused in this initiation between JAVA and USB for a long
while. Could someone
give me any advices to the connection about the USB at the Linux?

Whatever Thanks your reading ^^
------------------------------------------------------------------------------
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel

Reply via email to