General process of USB device detection

xiaoxiao2021-03-06  56

USB device detection is also made by the USB file system under the / procalog. In order to make a USB device work normally, you must now insert a USB bridge module now. At the beginning of the test, it is generally necessary to detect whether there is a / proc / bus / usb directory. If there is no existence, try inserting the USB bridge module.

Now there are two types, UHCI and OHCI now, now general USB bridge modules. When deciding to insert the bridge module, you can check the / proc / pci file to determine. Open this file, if you find USB sections as I / O at 0xHHHH format (for example, I / O AT 0xE000 [0xE01F]), HHHH is 16-based, the bridge type is UHCI. If it is a 32 bit memory at 0xHH000000 (for example, 32 bit memory at 0xee000000000000000000), the HH is 16-based, the bridge type is OHCI. However, if your bridge type does not meet any of the above situations, the only solution is that you try to insert these two modules until success. In general, the UHCI type bridge has its insertion module to UHCI or USB-UHCI (determined by the kernel version); and the insertion module for the OHCI type bridge is OHCI or USB-OHCI.

After you insert the bridge module correctly, the USB device directory will appear under the / proc file system, but this directory is empty, no files. At this point you must be hooked, then the connected device is detected by this file system. After successfully mounting the USB file system, you will generate file / proc / bus / usb / devices, / proc / bus / usb / drivers, and directory / proc / bus / usb / busno. Mount USBDEVFS files You can implement as follows:

Mount -T USBDEVFS NONE / PROC / BUS / USB

Or join / etc / fstab

None / Proc / Bus / USB USBDEVFS Defaults 0 0 0

Then pass the content of the / proc / bus / usb / defices file, you can get the connected device information, including the device identification and manufacturing trademarks.

USB device type description:

Equipment specification device class interface class code

Application specific - 0xfe

Voice interface 0x00 0x01

Communication equipment 0x02 -

CDC Control Interface - 0x02

CDC Data Interface - 0x0A

HID 0x00 0x03

HUB 0x09 0x09

Batch storage device 0x00 0x08

Monitor Same As Hid Same as HID

Power Equipment Same as Hid Same as HID

Physical equipment - 0x05

Printer - 0x07

Supplier specific - 0xff

5.2 Introduction to USB File System

T = bus topology (Lev, PRNT, PORT, CNT, etc.) refers to a connection between USB devices and hosts

B = Bandwidth (only for USB main controller)

D = device description information

P = product identification information

S = string descriptor

C = Configuration Description Information (* Represents activity configuration)

I = Interface Description Information

E = terminal point description information

General format:

D = decimal number

X = sixteen

S = string

Topology information

T: bus = dd lev = DD PRNT = DD port = DD CNT = DD DEV # = DDD SPD = DDD MXCH = DD

| | | | | | | | | | |

| | | | | | | | | | | | | | | | | | __ Equipment Number

| | | | | | __ This layer of the device

| | | | | | Parent connector / port of this device

| | | | | | Parent Equipment Number

| | | | __Hage of this bus in the topology

| | | __Burrow number

| __ topology information logo

Bandwidth information

B: Alloc = DDD / DDD US (XX%), # int = DDD, # ISO = DDD

| | | | | | | Synchronous Request Number

| | | | __ 中断 Request Number

| | __ Assign the total bandwidth to this bus

| __Bed Wide Information Sign

Device description information and product identification information

D: Ver = x.xx CLS = xx (s) sub = xx prot = xx mxps = DD # cfgs = DD

P: vendor = xxxx product = xxxx rev = xx.xx

D: Ver = X.xx CLS = XX (SSSSS) SUB = XX Prot = XX MXPS = DD # cfgs = DD

| | | | | | | | __ Configuration Number

| | | | | | ______ The maximum package size of the default endpoint

| | | | | | |

| | | | | | __Text

| | | | | | __ 设备 类 type

| | | | | __ device type

| | | __Electrical USB version

| __ 设备 设备 信息 信息 标号 # 1

P: vendor = xxxx product = xxxx rev = xx.xx

| | | | | | __ Product Revision

| | | | | __ Product Identification Code

| | | __Mander ID Code

| __ 地 设备 信息 信息 号 # 2

String description information

S: Manufacturer = SSSS

Manufacturer information read by | __

| __ String Description Information

S: Product = SSSS

Product description information read on the device, for the USB main controller this field is "USB * HCI Root Hub"

| __ String Description Information

S: serialnumber = ssss

The serial number read on the __ device, for the USB main controller it is a generated string, indicating the device identification

| __ String Description Information

Configuration description information

C: # IFS = DD CFG # = DD ATR = XX MPWR = DDDMA

| | | | | | Maximum Current (MA)

| | | | | | __ attribute

| | | | | __ Configuration Number

| | | __ interface number

| __ configuration information logo

Interface Description Information (Multiple)

I: if # = dd alt = DD # EPS = DD CLS = XX (SSSSS) SUB = XX Prot = XX Driver = SSSS

| | | | | | | | | __ Driven

| | | | | | | | __ interface protocol

| | | | | | __ interface subclass

| | | | | | __ interface class

| | | | | __ interrupt point number

| | | | | __ variable setting number

| | | __ interface number

| __ interface information logo

Terminal point description information

E: AD = xx (s) ATR = XX (SSSS) MXPS = DDDD IVL = DDDMS

E: AD = xx (s) ATR = XX (SSSS) MXPS = DDDD IVL = DDDMS

| | | | | | | Interval

| | | | | __ Terminal Point Maximum Package

| | | | | __ attribute (terminal point type)

| | __ Terminal Address (i = in, o = OUT)

| __ terminal point information logo

转载请注明原文地址:https://www.9cbs.com/read-113648.html

New Post(0)