Пример #1
0
 private static UsbDevice getDevice() {
   UsbDevice device = null;
   ArrayList<UsbDevice> devices = new ArrayList<UsbDevice>();
   try {
     devices = (ArrayList<UsbDevice>) us.visitUsbDevices(new VendorProductVisitor(0xfce));
   } catch (LibUsbNoDeviceException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (LibUsbPermissionException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (LibUsbOtherException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   if (devices.size() > 0) {
     device = devices.get(0);
   }
   return device;
 }
Пример #2
0
 public static void cleanup() throws Exception {
   us.cleanup();
 }