4

I have a Samsung Galaxy Win phone, rooted and with adbd insecure installed (using the link here).

This is the information shown by the USB OTG Checker app:

I have added the android.hardware.usb.host.xml file into /system/etc/permissions folder and the USB-OTG app says that my phone is now OTG capable (before, it showed that OTG is not supported only due to the missing xml file).

When I connect OTG cable and a USB drive, nothing happens at all. Same with a USB mouse. The USB Device Info app says nothing is connected. It's possible USB OTG hardware itself is missing from this phone, but it is very difficult to find any information about this model at all (it was really difficult to get this phone rooted in the first place).

Is there a definitive way to know whether the phone supports OTG or not? Is there a Java function that I could call which would confirm OTG, or is there any function that would crash if OTG is not present at the hardware level?

EDIT 1:

Output after doing the procedure mentioned in the comment:

"Do with root privileges: cd /sdcard && find /sys | sort >1. Connect USB. Then: find /sys | sort >2 && diff 1 2. This will let you know how kernel treats USB hardware."

--- 1
+++ 2
@@ -17357,10 +17357,15 @@
 /sys/kernel/debug/binder/failed_transaction_log
 /sys/kernel/debug/binder/proc
 /sys/kernel/debug/binder/proc/19015
-/sys/kernel/debug/binder/proc/19034
 /sys/kernel/debug/binder/proc/21683
 /sys/kernel/debug/binder/proc/22063
 /sys/kernel/debug/binder/proc/22112
+/sys/kernel/debug/binder/proc/22152
+/sys/kernel/debug/binder/proc/22166
+/sys/kernel/debug/binder/proc/22185
+/sys/kernel/debug/binder/proc/22197
+/sys/kernel/debug/binder/proc/22212
+/sys/kernel/debug/binder/proc/22224
 /sys/kernel/debug/binder/proc/2788
 /sys/kernel/debug/binder/proc/2796
 /sys/kernel/debug/binder/proc/2797
@@ -17402,12 +17407,7 @@
 /sys/kernel/debug/binder/proc/5383
 /sys/kernel/debug/binder/proc/5972
 /sys/kernel/debug/binder/proc/6076
-/sys/kernel/debug/binder/proc/6343
 /sys/kernel/debug/binder/proc/6358
-/sys/kernel/debug/binder/proc/6370
-/sys/kernel/debug/binder/proc/6382
-/sys/kernel/debug/binder/proc/6397
-/sys/kernel/debug/binder/proc/6410
 /sys/kernel/debug/binder/proc/6423
 /sys/kernel/debug/binder/proc/6439
 /sys/kernel/debug/binder/proc/6479
4
  • 2
    Check the kernel log via dmesg before and after connecting an USB OTG device. Usually you should see something in the kernel log if a new USB device is detected. Another potential reason why OTG does not work is if the USB port does not supply power. Try to use an active powered hub in between.
    – Robert
    Commented Nov 15, 2019 at 13:18
  • @Robert do I run that on the phone? How do I run this? Typing this in a terminal app says /system/bin/sh: dmseg: not found
    – user17915
    Commented Nov 15, 2019 at 13:28
  • Execute it via adb, and type it correctly then it will work.
    – Robert
    Commented Nov 15, 2019 at 13:50
  • Duplicate: How can I determine if my device has USB Host Mode (OTG) support? Commented Feb 24, 2020 at 16:03

1 Answer 1

2

USB OTG is a hardware capability. Software can't tell if the hardware has this capability or not if it's not configured to do so. The app you show is just confirming the presence of host.xml file that you have put yourself. Also you can confirm that form adb shell:

~$ pm list features | grep usb.host
# OR
~$ dumpsys package features | grep usb.host

For USB OTG to work, first your kernel should create a hardware entry in /sys as per device-tree mapping when you connect USB drive.
Secondly a device should be populated in /dev/bus/usb/... (and /dev/block/... if it's a storage device). It depends on uevent configuration on your ROM. Or you may also manually create device using mknod.

Thirdly you need to place host.xml file so that OS and apps can know that USB OTG support is present on device. Now apps can access USB device directly (provided that proper permissions are set on device path and node) by making use of host mode APIs.
Lastly if your ROM supports auto-mounting USB Storage devices (available on Android 6+), you should have an entry for vold in fstab. See How to disable USB OTG on Android 8.1?

As suggested, your Edit 1 shows that the changes in sysfs after attaching USB are only in debugfs, no hardware is detected by kernel.

One last thing you can do is to use a powered USB hub as suggested by @Robert in comment. Also check dmesg log for kernel messages and logcat for USBManager and USBHost messages in Java stack. If no hardware is detected then your hardware or at least kernel doesn't support USB.

You must log in to answer this question.

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