USB device detection is also performed through the USB file system under the/proc directory. To make a USB device work properly, you must insert a USB Bridge module into the system. At the beginning of the check, it is generally necessary to check whether the/proc/bus/usb directory exists. If not, try to insert the USB Bridge module.
There are two types of USB bridging modules: UHCI and OHCI. When deciding to insert the bridge module, you can view the/proc/pci file. Open this file. If you find that the USB node is in the I/O at 0xHHHH format, for example, if I/O at 0xe000 [0xe01f]) and HHHH is in hexadecimal format, the bridge type is UHCI. If it is in the format of 32 bit memory at 0xHH000000, for example, 32 bit memory at 0xee000000) and HH is a hexadecimal number, the bridge type is OHCI. However, if your bridge type does not meet any of the above conditions, the only solution is to try to insert the two modules until they are successful. Generally, the insertion module of a UHCI bridge is uhci or usb-uhci determined by the kernel version), and the insertion module of an OHCI bridge is ohci or usb-ohci.
After you have correctly inserted the bridge module, the USB device directory will appear in the/proc file system. However, the directory is empty and there are no files. In this case, you must connect to the USB devfs file system, and then detect the connected device through this file system. After the usb file system is mounted, the file/proc/bus/usb/devices,/proc/bus/usb/drivers and directory/proc/bus/usb/busNo are generated. To mount a usbdevfs file, you can perform the following operations:
Mount-t usbdevfs none/proc/bus/usb
Or add it to/etc/fstab.
None/proc/bus/usb usbdevfs defaults 0 0
Then, you can obtain the connected device information through the/proc/bus/usb/devices file, including the device identification and manufacturing trademark information.
Usb device type description:
Device specification device code interface code
Application-specific-0xFE
Sound Interface 0x00 0x01
Communication device 0x02-
CDC control interface-0x02
CDC data interface-0x0A
HID 0x00 0x03
HUB 0x09 0x09
Batch storage devices 0x00 0x08
Monitor same as HID
Power supply device same as HID
Physical device-0x05
Printer-0x07
Supplier-0xFF
5.2 introduction to usb file system
T = the bus topology (maid, Prnt, Port, Cnt, etc.) refers to the connection mode between the USB device and the host.
B = bandwidth (for USB master controller only)
D = device description
P = product ID information
S = string Descriptor
C = configuration description (* indicates activity configuration)
I = Interface Description
E = terminal POint Description
General format:
D = decimal number
X = hexadecimal number
S = string
Topology Information
T: Bus = dd lev= dd Prnt = dd Port = dd Cnt = dd Dev # = ddd Spd = ddd MxCh = dd
| ||__ Maximum sub-Device
| ||__ Device speed (Mbps)
| |__ Device number
| |__ Number of devices on this layer
| |||__ Parent connector/port of the device
| ||__ Parent device number
| ||__ Hierarchy of the bus in the Topology
| |__ Bus ID
|__ Topology information flag
Bandwidth Information
B: Alloc = ddd/ddd us (xx %), # Int = ddd, # Iso = ddd
| ||__ Synchronous Request ID
| |__ Interrupt request number
| |__ Total bandwidth allocated to this bus
|__ Bandwidth information mark
Device description and product identification information
D: Ver = x. xx Cls = xx (s) Sub = xx Prot = xx MxPS = dd # Cfgs = dd
P: Vendor = xxxx ProdID = xxxx Rev = xx. xx
D: Ver = x. xx Cls = xx (sssss) Sub = xx Prot = xx MxPS = dd # Cfgs = dd
| |__ Configuration number
| ______ Maximum package size of the default terminal point
|
||||__ Device Protocol
|||__ Device subtype
||__ Device type
| |__ USB Version of the device
|__ ID of the device information flag #1
P: Vendor = xxxx ProdID = xxxx Rev = xx. xx
| ||__ Product Revision No.
| |__ Product ID code
| |__ Manufacturer ID code
|__ ID of the device information flag #2
String description
S: Manufacturer = ssss
|__ Manufacturer information read from the device
|__ String description
S: Product = ssss
| |__ Product description information read from the device. For USB master controller, this field is "USB * HCI Root Hub"
|__ String description
S: SerialNumber = ssss
| |__ Serial number read from the device, which is a generated string for the USB master controller, indicating the device ID
|__ String description
Configuration description
C: # Ifs = dd Cfg # = dd recognition = xx MPwr = dddmA
| |__ Maximum current mA)
|||__ Attributes
| |__ Configuration number
|__ Number of interfaces
|__ Configuration information flag
Interface Description (multiple parameters can be entered)
I: If # = dd Alt = dd # EPs = dd Cls = xx (sssss) Sub = xx Prot = xx Driver = ssss
| ||__ Driver name
| |__ Interface Protocol
| |__ Sub-class of the interface
| |||__ Interface Class
|||__ Number of interrupted points
| |__ Variable number setting
| |__ Interface ID
|__ Interface Information flag
Terminal POint Description
E: Ad = xx (s) ASD = xx (ssss) MxPS = dddd Ivl = dddms
E: Ad = xx (s) ASD = xx (ssss) MxPS = dddd Ivl = dddms
||||__ Interval
| |__ Maximum terminal point package size
| |__ Properties (terminal point type)
| |__ Terminal point address (I = In, O = Out)
|__ Terminal Point Information flag'