5

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

2 Answers 2

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.

4

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.

1
  • 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! Mar 10, 2016 at 10:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .