4.4.3.2. 详细分析USB枚举数据的每个字段的具体含义
接下来,就是分析,每一部分的数据,到底对应的是何种含义。
此处,再把上述数据贴出来,并进行分析:
0902420002010480E1
0904000002FF000000
092110010001223F00
07050103400001
07058103400001
090401000103000000
092110010001222100
0705820340000A
| 此部分内容对应着的是:Configuration 其定义为: 表 4.3. USB Configuration Descriptors Offset | Field | Size | Value | Description |
---|
0 | bLength | 1 | Number | Size of Descriptor in Bytes | 1 | bDescriptorType | 1 | Constant | Configuration Descriptor (0x02) | 2 | wTotalLength | 2 | Number | Total length in bytes of data returned | 4 | bNumInterfaces | 1 | Number | Number of Interfaces | 5 | bConfigurationValue | 1 | Number | Value to use as an argument to select this configuration | 6 | iConfiguration | 1 | Index | Index of String Descriptor describing this configuration | 7 | bmAttributes | 1 | Bitmap |
| 8 | bMaxPower | 1 | mA | Maximum Power Consumption in 2mA units |
其每个字节对应的含义为:
|
| 此部分内容对应着的是:Interface 其定义为: 表 4.4. USB Interface Descriptors Offset | Field | Size | Value | Description |
---|
0 | bLength | 1 | Number | Size of Descriptor in Bytes (9 Bytes) | 1 | bDescriptorType | 1 | Constant | Interface Descriptor (0x04) | 2 | bInterfaceNumber | 1 | Number | Number of Interface | 3 | bAlternateSetting | 1 | Number | Value used to select alternative setting | 4 | bNumEndpoints | 1 | Number | Number of Endpoints used for this interface | 5 | bInterfaceClass | 1 | Class | Class Code (Assigned by USB Org) | 6 | bInterfaceSubClass | 1 | SubClass | Subclass Code (Assigned by USB Org) | 7 | bInterfaceProtocol | 1 | Protocol | Protocol Code (Assigned by USB Org) | 8 | iInterface | 1 | Index | Index of String Descriptor Describing this interface |
其每个字节对应的含义为:
|
| 此部分内容对应着的是:Class 由于其前面的中bInterfaceClass=0xFF,对应着表 4.1 “USB Class表”中的vendor-specific,所以此部分的值的含义,是针对特定厂家的特定的含义,因此此处就不具体解释了。 |
| 此部分内容对应着的是:Endpoint 其定义为: 表 4.5. USB Endpoint Descriptors Offset | Field | Size | Value | Description |
---|
0 | bLength | 1 | Number | Size of Descriptor in Bytes (7 bytes) | 1 | bDescriptorType | 1 | Constant | Endpoint Descriptor (0x05) | 2 | bEndpointAddress | 1 | Endpoint | Endpoint Address
| 3 | bmAttributes | 1 | Bitmap |
| 4 | wMaxPacketSize | 2 | Number | Maximum Packet Size this endpoint is capable of sending or receiving | 6 | bInterval | 1 | Number | Interval for polling endpoint data transfers. Value in frame counts. Ignored for Bulk & Control Endpoints. Isochronous must equal 1 and field may range from 1 to 255 for interrupt endpoints. |
其每个字节对应的含义为:
|
| 此部分内容和类似,也是对应着:Endpoint 对应定义为:表 4.5 “USB Endpoint Descriptors” 其每个字节对应的含义为:
|
| 此部分内容对应着的是:Interface 其定义为参考:表 4.4 “USB Interface Descriptors” 其每个字节对应的含义为:
|
| 由于中bInterfaceClass=0x03,对应着表 4.1 “USB Class表”中的HID,所以,此部分内容的解析,依赖于对应的HID中的定义。 可在官方的1.1版本的HID协议:HID1_11.pdf中的“6.2.1 HID Descriptor”部分找到对应的定义: 表 4.6. USB HID Descriptors Part | Offset/Size(Bytes) | Description |
---|
bLength | 0/1 | Numeric expression that is the total size of the HID descriptor. | bDescriptorType | 1/1 | Constant name specifying type of HID descriptor. | bcdHID | 2/2 | Numeric expression identifying the HID Class Specification release. | bCountryCode | 4/1 | Numeric expression identifying country code of the localized hardware. | bNumDescriptors | 5/1 | Numeric expression specifying the number of class descriptors (always at least one i.e. Report descriptor.) | bDescriptorType | 6/1 | Constant name identifying type of class descriptor. See Section 7.1.2: Set_Descriptor Request for a table of class descriptor constants. | wDescriptorLength | 7/2 | Numeric expression that is the total size of the Report descriptor. | [bDescriptorType] | 9/1 | Constant name specifying type of optional descriptor. | [wDescriptorLength] | 10/2 | Numeric expression that is the total size of the optional descriptor. |
其每个字节对应的含义为: 表 4.7. USB HID Descriptor: 090401000103000000 Offset | Field | Size | Value | Description |
---|
0 | bLength | 1 | 09 | the total size of the HID descriptor =9 bytes | 1 | bDescriptorType | 1 | 21 | descriptor constant, HID = 0x21 | 2 | bcdHID | 2 | 1001 | HID Class Specification release 0x0110= 1.10 | 4 | bCountryCode | 1 | 00 | No country code of the localized hardware | 5 | bNumDescriptors | 1 | 01 | the number of class descriptors = 1 | 6 | bDescriptorType | 1 | 22 | Class descriptor constant, 0x22 = Report descriptor | 7 | wDescriptorLength | 2 | 2100 | the total size of the Report descriptor =0x0021=33 bytes | 9 | [bDescriptorType] | 2 | | | 10 | [wDescriptorLength] | | | |
|
| 此部分内容和类似,也是对应着:Endpoint 对应定义为:表 4.5 “USB Endpoint Descriptors” 其每个字节对应的含义为:
|