3

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

5

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.

3

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.

  • 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 '16 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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