I tried to write a simple program to retreive my topology and it produce the
following error:

Exception in thread "javax.usb Linux implementation Topology Poller"
java.lang.NullPointerException
        at
com.ibm.jusb.os.linux.LinuxUsbServices.setActiveConfigAndInterfaceSettings(LinuxUsbServices.java:332)
        at
com.ibm.jusb.os.linux.LinuxUsbServices.updateTopology(LinuxUsbServices.java:225)
        at
com.ibm.jusb.os.linux.LinuxUsbServices.access$000(LinuxUsbServices.java:26)
        at 
com.ibm.jusb.os.linux.LinuxUsbServices$1.run(LinuxUsbServices.java:141)
        at java.lang.Thread.run(Thread.java:595)

Looking at it, I noticed the error was caused by my APC UPS not returning a
valid configuration. The active config number returned was 98. It seems that it
being set correctly, but getAcitiveUsbConfiguration() returns null. This is how
I fixed it for myself:

UsbConfiguration usbConfig = device.getActiveUsbConfiguration();
if (usbConfig == null)
    return;

//Iterator interfaces =
device.getActiveUsbConfiguration().getUsbInterfaces().iterator();
Iterator interfaces = usbConfig.getUsbInterfaces().iterator();

I'm not sure what's the best way to deal with it since it's the first day I'm
using javax.usb or anything usb.


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel

Reply via email to