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.
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:
The following devices could not enumerate the device:
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.
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.
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 */
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With