Saturday, 31 January 2015

USB OTG host mode API issues with some Android devices

It has been reported recently that some devices doesn't support USB API correctly, despite having Android version > 3.1 (the first release with USB OTG host mode API available to application layer).

Basically, the non-functioning devices can be divided into two groups:

a) Hardware USB host mode not implemented.

A good example is LG Swift G (or related) mobile handheld, a rumour says that +5V DC supply voltage is not available, a result of hardware cost-cutting. Obviously there's nothing that could be done to enable USB host mode on those devices

b) Hardware USB compatible with host mode, Android version >=3.1, pendrive or mouse works fine, yet no USB devices are visible form the application layer.

This mostly is true when it comes to no-name devices (tablets), it looks as if manufacturers were in a big rush to release a product and forgot to properly configure Android OS.

Some devices can be fixed, a solution is to modify/copy a file in the /system/etc/permissions.

One must have root access to able to remount and modify those files.

See the thread:

http://stackoverflow.com/questions/11183792/android-usb-host-and-hidden-devices

Quotation from the above link:

"To enable USB host API support you should add a file named
android.hardware.usb.host.xml
and containing the following lines:

<permissions> <feature name="android.hardware.usb.host"/> </permissions>

into folder

/system/etc/permissions

in that folder find file named

handheld_core_hardware.xml or tablet_core_hardware.xml

and add

<feature name="android.hardware.usb.host" />

into <permissions> section.

Reboot your device. Usb host api should work."


Some tablets have root by default, it's only necessary to switch into superuser, this can be done with Total Commander

http://www.androidpolice.com/2011/07/25/tip-how-to-enable-writing-to-read-only-partitions-remount-rw-in-total-commander-for-android/

Or by using "adb" command-line utility:

http://forum.xda-developers.com/showthread.php?p=48915118#post48915118


adb shell 
 su
 mount -o rw,remount -t ext4 /system



Be careful with system files/directories it's very easy to brick your device. First make sure you are able to restore the original OS rom image (in case of...) before trying the above hack.





4 comments:

  1. android.hardware.usb.host.xml i have this file but not working!

    ReplyDelete
  2. I dont have this file what can i do or how can i add it

    ReplyDelete
  3. I dont have this file what can i do or how can i add it

    ReplyDelete
  4. hi,
    im trying to connect an usb obd elm327 interface, it is possible?

    Thanks.

    ReplyDelete