sheldon_blogs

Android :USB设备信息获取

lsusb:查看系统当前连接的所有USB设备

 

cat /sys/kernel/debug/usb/devices : 每个USB设备及其配置描述符

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480  MxCh= 1    //第一层 EHCI 控制器
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev= 5.04
S:  Manufacturer=Linux 5.4.86-android11-2-g9b3456a83314-dirty xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=xhci-hcd.0.auto
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 4   //第二层 HUB               
D:  Ver= 2.10 Cls=09(hub  ) Sub=00 Prot=02 MxPS=64 #Cfgs=  1
P:  Vendor=2109 ProdID=2817 Rev=90.13
S:  Manufacturer=VIA Labs, Inc.
S:  Product=USB2.0 Hub
S:  SerialNumber=000000000
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=01 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   1 Ivl=256ms
I:* If#= 0 Alt= 1 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=02 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   1 Ivl=256ms

T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 11 Spd=480  MxCh= 0  //第三层 连接到HUB上的设备
D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0bda ProdID=b812 Rev= 2.10
S:  Manufacturer=Realtek
S:  Product=802.11ac NIC
S:  SerialNumber=123456
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 5 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=87(I) Atr=03(Int.) MxPS=  64 Ivl=500us
E:  Ad=08(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms


 

cat /proc/bus/input/devices :查看连接的输入设备信息

 

cat sys/bus/usb/devices/2-1.1/ :查看对应USB设备的详细信息,例如 2-1.1:1.0 命名规则是:roothub-port:configuration.interface.)

 

cat /sys/bus/usb/devices/2-1.1\:1.0/bInterfaceClass :查看当前设备所支持的特性,例如: 01 表示支持audio

 

只查看连接设备的端口信息:

# ls /sys/bus/usb/drivers/usb/
1-1 1-1.2 1-1.2.3.1 1-1.3.1 2-1 2-1.2.3 uevent usb1
1-1.1 1-1.2.3 1-1.3 1-1.3.3 2-1.2 bind unbind usb2

 查看主次设备号:

# cat /sys/bus/usb/devices/1-1.4/uevent
MAJOR=189
MINOR=9
DEVNAME=bus/usb/001/010
DEVTYPE=usb_device
DRIVER=usb
PRODUCT=bda/b812/210
TYPE=0/0/0
BUSNUM=001
DEVNUM=010

 

 

https://www.itread01.com/p/1350883.html

\system\core\libusbhost\usbhost.c

\frameworks\base\services\core\jni\com_android_server_UsbHostManager.cpp

\frameworks\base\core\java\android\hardware\usb\UsbInterface.java

\frameworks\base\services\usb\java\com\android\server\usb\UsbHostManager.java

\frameworks\base\services\usb\java\com\android\server\usb\UsbService.java

posted on 2020-03-21 17:59  sheldon_blogs  阅读(10297)  评论(0编辑  收藏  举报

导航