10

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.

6
  • Post some code please? Commented Nov 10, 2015 at 23:28
  • Just did. It's a very basic case, so I'm not sure how helpful it is.
    – Mike Ortiz
    Commented Nov 11, 2015 at 0:41
  • Can you print the results? Did you add the appropriate permissions? Commented Nov 11, 2015 at 0:48
  • Yes, permissions aren't an issue. Other devices are enumerated just fine. Not sure what results I could print besides an empty hash map.
    – Mike Ortiz
    Commented Nov 11, 2015 at 0:58
  • Did you figure this out? Commented Nov 11, 2015 at 2:43

2 Answers 2

2
+150

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.

2
  • Great hint about using adb shell dmesg. Here are the logs. On lines 4-16, it shows the USB device enumeration failed. I don't think the issue is with power. This device draws 100mA vs another USB device I can enumerate successfully which draws 500mA. Is there any way to get a better grasp of what could be causing the issue? And is there a workaround, even if root is required?
    – Mike Ortiz
    Commented Nov 13, 2015 at 19:57
  • 1
    At this point debugging the issue further requires either building a kernel with more logging (so you can figure out what requests are failing and perhaps more detail) or purchasing a USB protocol sniffer to see if anything unusual is happening on the wire. Commented Nov 15, 2015 at 19:21
1

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 */

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.