Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can I use adb shell command to detect the phone support OTG to transmission the files with an USB Flash Drive with OTG function?

share|improve this question
up vote 5 down vote accepted

Yes. All you need to do is test for the presence of the file that enables it. On devices that do:

# adb shell ls /system/etc/permissions/android.hardware.usb.host.xml
/system/etc/permissions/android.hardware.usb.host.xml

And otherwise:

# adb shell ls /system/etc/permissions/android.hardware.usb.host.xml
/system/etc/permissions/android.hardware.usb.host.xml: No such file or directory

Of course, it's possible for a device to be misconfigured — but you have to actually physcially test OTG to determine that.

share|improve this answer

If the OTG drive is plugged in at the time of the command, you can also detect OTG by querying these directories:

/storage/UsbDriveA     (Samsung devices)
/storage/USBstorage1   (LG G4, V10, G3, G2, LG devices)
/storage/usbdisk       (Moto Maxx, Turbo 2, Moto X Pure, Motorola devices)
/storage/usbotg        (Sony Xperia devices, Lenovo Tabs)
/storage/UDiskA        (Oppo devices)
/storage/usb-storage   (Acer Iconia Tabs)
/storage/usbcard       (Dell Venue -- Vanilla Android 4.3 tablet)
/storage/usb           (HTC One M7, some Vanilla Android tablets)

Tested on my collection of devices and a quick trip to Bestbuy for testing the latest flagships listed above. Edited to add input from other members here.

share|improve this answer
    
On my cheap Android tablet, it is mounted on \usb. But itis nice that you assembled this list. I had no idea it changed that much! – Ismael Miguel Mar 10 at 10:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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