Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't this specific device be enumerated by UsbManager.getDevicesList()?

As the title states, I am having troubles enumerating a specific USB device on a USB capable Android phone using UsbManager.getDeviceList(). I've had no trouble enumerating and communicating with other USB devices on this and other phones, but this specific USB device cannot be found. It also cannot be enumerated with 3rd party apps such as USB Device Info.

Below are the USB properties enumerated properly on a PC. I've communicated with the device manufacturer who has confirmed that an outside firm certified the device followed the USB 2.0 spec. Originally, my suspicion was that the device was rejected by Android because it omitted the following fields: iManufacturer, iProduct, and iSerialNumber, which were included by other compliant devices. However, it seems these fields aren't necessary after reviewing this excerpt from Section 9.5 of the USB 2.0 Spec:

Where appropriate, descriptors contain references to string descriptors that provide displayable information describing a descriptor in human-readable form. The inclusion of string descriptors is optional. However, the reference fields within descriptors are mandatory. If a device does not support string descriptors, string reference fields must be reset to zero to indicate no string descriptor is available.

My question, then, is what is causing the UsbManager to reject enumeration of this USB device? And, more importantly, is there anything I can do about it to force Android to enumerate this device? Ideally, I am most interested in a solution that does not require root access, but it is not necessarily a deal-breaker.

USB properties


EDIT: Some sample code.

UsbManager usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
HashMap<String, UsbDevice> deviceList = usbManager.getDeviceList();
// When I plug in this USB device, deviceList is empty. 
// Other devices are discoverable, however.

EDIT 2: I've tested with some more phones. I have successfully enumerated the USB device with the following phones:

  • Note 2
  • LG-V400

The following devices could not enumerate the device:

  • Nexus 5
  • Galaxy S4, S5, S6
  • LG G2, 4G LTE

EDIT 3: Here are the logs from calling adb shell dmesg on a Nexus 5 after plugging in the USB device. You can clearly see on lines 4-16 that the phone fails to enumerate the device.

like image 433
Mike Ortiz Avatar asked Nov 07 '15 01:11

Mike Ortiz


2 Answers

After connecting the USB device to your Android phone disconnect it and connect the phone to your computer so you can use adb shell dmesg to look at the kernel log. If you see the device show up in the kernel log then the phone is recognizing it and I'm not sure why it isn't returned by UsbManager. What I suspect is that it won't show up in the kernel log or there will be an error there. This probably means that the device is not compatible with the phone's OTG controller or is not getting enough power to function correctly.

like image 115
Reilly Grant Avatar answered Nov 15 '22 17:11

Reilly Grant


I don't have a solution and may not even have a helpful hint, but the error seems be somewhat explainable:

#define EOVERFLOW 75 /* Value too large for defined data type */
like image 30
Kaamel Avatar answered Nov 15 '22 19:11

Kaamel