0

My device - Nexus 5 with 4.4.4

Here is my code

UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
HashMap<String, UsbDevice> deviceList = manager.getDeviceList();
Log.e(TAG, "get device list  = " + deviceList.size());
Toast.makeText(this, "get device list  = " + deviceList.size(), 200).show();
Iterator<UsbDevice> deviceIterator = deviceList.values().iterator();
while (deviceIterator.hasNext()) {
   UsbDevice device = deviceIterator.next();
   Log.e(TAG, "device name = " + device.getDeviceName());
}

But, always return empty. i try to root my device. Follow this answer. But, i plug mouse and keyboard with OTG cable to Nexus 5. it does not work. Any idea how to solve it?

Updated: I try USB card reader and USB Camera. It can detect them. Does Android filter USB mouse and keyboard devices?

Community
  • 1
  • 1
KingWu
  • 370
  • 1
  • 4
  • 21
  • Does a USB mouse get you a mouse cursor? (It does on my host-capable phone) If the device is claimed by the OS like that, it may not show in the USB host API. – Chris Stratton Oct 23 '14 at 03:37
  • Yes. It shows a mouse cursor. Except mouse and keyboard, do you know devices is detected by OS but not show in USB host API? – KingWu Oct 23 '14 at 11:34

0 Answers0