1

Topic: Android: whether It is supported USB OTG

Hi, All! How  to define, whether supports a device a host mode (USB OTG)? I dig in  API and something I do not find anything similar. During too time, there are programs of type USB OTG Checker which do it. How? Or they stupidly check device model under the hardwired list?

2

Re: Android: whether It is supported USB OTG

Hello, sz36, you wrote: S> As  to define, whether supports a device a host mode (USB OTG)? I dig in  API and something I do not find anything similar. During too time, there are programs of type USB OTG Checker which do it. How? Or they stupidly check device model under the hardwired list? I of concept have as they no it do, but unless it is impossible from   to be rummaged around on/sys? [aik@aik ~] $ adb shell santoni:/$ santoni:/$ find/sys-iname "*otg *"/sys/bus/platform/drivers/msm_otg /sys/devices/soc/qpnp-smbcharger-17/regulator/regulator.44/78db000.usb-vbus_otg /sys/devices/soc/78db000.usb/msm_hsusb/udc/msm_hsusb/is_otg /sys/devices/soc/78db000.usb/power_supply/usb/usb_otg /sys/firmware/devicetree/base/soc/usb@78db000/qcom,hsusb-otg-mpm-dmsehv-int /sys/firmware/devicetree/base/soc/usb@78db000/qcom,hsusb-otg-phy-type /sys/firmware/devicetree/base/soc/usb@78db000/qcom,hsusb-otg-otg-control /sys/firmware/devicetree/base/soc/usb@78db000/vbus_otg-supply /sys/firmware/devicetree/base/soc/usb@78db000/qcom,hsusb-otg-mode /sys/firmware/devicetree/base/soc/usb@78db000/qcom,hsusb-otg-delay-lpm /sys/firmware/devicetree/base/soc/usb@78db000/qcom,hsusb-otg-mpm-dpsehv-int /sys/firmware/devicetree/base/soc/qcom,spmi@200f000/qcom,pmi8950@2/qcom,qpnp-smbcharger/qcom,otg@1100 /sys/firmware/devicetree/base/soc/qcom,spmi@200f000/qcom,pmi8950@2/qcom,qpnp-smbcharger/qcom,smbcharger-boost-otg find:/sys/kernel/slab/L2TP/IPv6: No such file or directory find:/sys/kernel/slab/L2TP/IP: No such file or directory/sys/kernel/debug/msm_otg/sys/kernel/debug/msm_otg/otg_state/sys/kernel/debug/clk/xo_otg_clk /sys/kernel/debug/regulator/smbcharger_charger_otg /sys/kernel/debug/regulator/smbcharger_charger_otg/78db000.usb-vbus_otg /sys/kernel/debug/regulator/smbcharger_charger_otg/smbcharger_charger_otg

3

Re: Android: whether It is supported USB OTG

Hello, aik, you wrote: aik> I of concept have as they no it do, but unless it is impossible from   to be rummaged around on/sys? From  I do not know (I be not able yet), but also from the console the criterion of presence OTG is not obvious to me. Here an output of the device which is able OTG shell@P024_1:/$ find/sys-iname "*otg *" find: No/sys/fs/cgroup: Permission denied find: No/sys/fs/pstore: Permission denied/sys/bus/platform/drivers/msm_otg /sys/devices/soc.0/78b8000.i2c/i2c-4/4-006a/regulator/regulator.36/78d9000.usb-vbus_otg /sys/devices/soc.0/78b8000.i2c/i2c-4/4-006a/power_supply/otg find: No/sys/devices/system/cpu/cpu0/rq-stats: Permission denied find: /sys/devices/virtual/graphics/fb0/dynamic_fps: Permission denied find: /sys/devices/virtual/graphics/fb0/idle_time: Permission denied find: /sys/devices/virtual/graphics/fb1/idle_time: Permission denied find: /sys/devices/virtual/smdpkt/smdcntl0/open_timeout: Permission denied find: /sys/devices/virtual/smdpkt/smdcntl1/open_timeout: Permission denied find: /sys/devices/virtual/smdpkt/smdcntl2/open_timeout: Permission denied find: /sys/devices/virtual/smdpkt/smdcntl3/open_timeout: Permission denied find: /sys/devices/virtual/smdpkt/smdcntl4/open_timeout: Permission denied find: /sys/devices/virtual/smdpkt/smdcntl5/open_timeout: Permission denied find: /sys/devices/virtual/smdpkt/smdcntl6/open_timeout: Permission denied find: /sys/devices/virtual/smdpkt/smdcntl7/open_timeout: Permission denied find: /sys/devices/virtual/smdpkt/smdcntl8/open_timeout: Permission denied find: /sys/devices/virtual/smdpkt/smdcntl9/open_timeout: Permission denied find: /sys/devices/virtual/smdpkt/smdcntl10/open_timeout: Permission denied find: /sys/devices/virtual/smdpkt/smdcntl11/open_timeout: Permission denied /sys/devices/platform/msm_hsusb/udc/msm_hsusb/is_otg/sys/class/power_supply/otg find:/sys/power/wake_unlock: Permission denied find:/sys/power/wake_lock: Permission denied find:/sys/kernel/slab/L2TP/IPv6: No such file or directory find:/sys/kernel/slab/L2TP/IP: No such file or directory/sys/kernel/debug/msm_otg/sys/kernel/debug/msm_otg/otg_state find:/sys/kernel/debug/cadiz/write_reg: Permission denied find:/sys/kernel/debug/cadiz/read_reg: Permission denied/sys/kernel/debug/clk/xo_otg_clk /sys/kernel/debug/regulator/smb345_otg_vreg /sys/kernel/debug/regulator/smb345_otg_vreg/78d9000.usb-vbus_otg /sys/kernel/debug/regulator/smb345_otg_vreg/smb345_otg_vreg find:/sys/kernel/uevent_helper: Permission denied find: /sys/module/lowmemorykiller/parameters/adj: Permission denied find: /sys/module/lowmemorykiller/parameters/cost: Permission denied find: /sys/module/lowmemorykiller/parameters/vmpressure_file_min: Permission denied find: /sys/module/lowmemorykiller/parameters/lmk_fast_run: Permission denied find: /sys/module/lowmemorykiller/parameters/minfree: Permission denied find: /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk: Permission denied find: /sys/module/lowmemorykiller/parameters/debug_level: Permission denied find:/sys/module/lowmemorykiller/uevent: Permission denied find: /sys/module/msm_thermal/core_control/cpus_offlined: Permission denied 1|shell@P024_1:/$ And here the device in which is not present OTG: shell@ kminilte:/$ find/sys-iname "*otg *" find: No/sys/fs/cgroup: Permission denied/sys/bus/platform/devices/s3c-hsotg/sys/bus/platform/drivers/s3c-hsotg /sys/bus/platform/drivers/s3c-hsotg/s3c-hsotg/sys/devices/virtual/sec/switch/otg_test/sys/devices/virtual/host_notify/usb_otg /sys/devices/platform/s3c2440-i2c.6/i2c-6/6-0034/rt5033-charger/power_supply/sec-charger/charge_otg_control find: No /sys/devices/platform/s3c2440-i2c.7/i2c-7/7-0068/iio:device0/power: Permission denied find: No /sys/devices/platform/s3c2440-i2c.7/i2c-7/7-0068/iio:device0/buffer: Permission denied find: No /sys/devices/platform/s3c2440-i2c.7/i2c-7/7-0068/iio:device0/trigger: Permission denied find: No /sys/devices/platform/s3c2440-i2c.7/i2c-7/7-0068/iio:device0/scan_elements: Permission denied/sys/devices/platform/s3c-hsotg /sys/devices/platform/s3c-hsotg/udc/s3c-hsotg /sys/devices/platform/s3c-hsotg/udc/s3c-hsotg/is_otg/sys/class/udc/s3c-hsotg/sys/class/host_notify/usb_otg/sys/kernel/debug/clock/otg 1|shell@ kminilte:/$

4

Re: Android: whether It is supported USB OTG

Hello, sz36, you wrote: aik>> I of concept have as they no it do, but unless it is impossible from   to be rummaged around on/sys? S> From  I do not know (I be not able yet), but also from the console the criterion of presence OTG is not obvious to me. Here an output of the device which is able OTG Yes,  it is not obvious as that there. I would think that criterion such - at first to define that is in/sys/bus/platform/drivers about otg and then to be rummaged around inside/sys/devices/soc/at what device is  on this driver, type: santoni:/$ find/sys/devices/soc-iname driver-exec ls-l {} \; | grep otg lrwxrwxrwx 1 root root 0 2018-06-04 18:51/sys/devices/soc/78db000.usb/driver->./././bus/platform/drivers/msm_otg S> And here the device in which is not present OTG: but in this device there can be a driver and is lifted.

5

Re: Android: whether It is supported USB OTG

It turned out! public final static boolean isUSBHost (Context context) {String usbFeature = PackageManager. FEATURE_USB_HOST; final PackageManager packageManager = context.getPackageManager (); final FeatureInfo [] featuresList = packageManager.getSystemAvailableFeatures (); for (FeatureInfo f: featuresList) {if (f.name! = null && f.name.equals (usbFeature)) {return true;}} return false;}