I've written a very simple program to find all the USB devices connected
to a system:
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);
}
}
}
}
What surprises me is how long this program takes to run. It's on the
order of 10 seconds. There are only two devices connected to the system.
What's happening that's taking so long? Where is the time going?
--
Elliotte Rusty Harold [EMAIL PROTECTED]
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel