FileDocCategorySizeDatePackage
USBStringLister.javaAPI DocExample1168Thu Feb 16 09:02:18 GMT 2006None

USBStringLister

public class USBStringLister extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidlistDevices(UsbHub hub)

    List devices = hub.getAttachedUsbDevices();
    Iterator iterator = devices.iterator();
    while (iterator.hasNext()) {
      UsbDevice device = (UsbDevice) iterator.next();
      listStrings(device);
      if (device.isUsbHub()) {
        listDevices((UsbHub) device);
      }
    } 
  
public static voidlistStrings(UsbDevice device)


    for (int i = 0; i <= 255; i++) {
      try {
        String s = device.getString((byte) i);
        System.out.println("  " + i + ":\t" + s);
      }
      catch (UsbStallException ex) {
        // We've reached the end of the table for this device.
        break;
      }
    }
    System.out.println();
  
public static voidmain(java.lang.String[] args)

    UsbServices services = UsbHostManager.getUsbServices();
    UsbHub root = services.getRootUsbHub();
    listDevices(root);