// searches for an adb interface on the given USB device
 private static UsbInterface findAdbInterface(UsbDevice device) {
   Log.d(TAG, "findAdbInterface " + device);
   int count = device.getInterfaceCount();
   for (int i = 0; i < count; i++) {
     UsbInterface intf = device.getInterface(i);
     if (intf.getInterfaceClass() == 255
         && intf.getInterfaceSubclass() == 66
         && intf.getInterfaceProtocol() == 1) {
       return intf;
     }
   }
   return null;
 }