当前位置 博文首页 > dadalaohua的博客:【USB描述符系列】二维码扫描枪
使用了一款USB接口的二维码扫描枪,看了下这个设备的描述符也没有什么特别的。从描述符可以看到,这个设备就是枚举成一个HID KeyBoard,和普通的键盘没有什么区别。二维码扫描枪在扫描获取到信息后,作为HID键盘设备上报了键值。用的这个USB设备是一个Full Speed设备。
下面是这个USB接口的二维码扫描枪的描述符,产品的VID和PID被我隐去了。
Offset | Field | Size | Value | Description |
---|---|---|---|---|
0 | bLength | 1 | 12h | Size of this descriptor |
1 | bDescriptorType | 1 | 01h | Device |
2 | bcdUSB | 2 | 0110h | USB Spec 1.1 |
4 | bDeviceClass | 1 | 00h | Class info in Ifc Descriptors |
5 | bDeviceSubClass | 1 | 00h | Unused |
6 | bDeviceProtocol | 1 | 00h | Unused |
7 | bMaxPacketSize0 | 1 | 40h | 64 bytes |
8 | idVendor | 2 | XXXXh | Vendor ID |
10 | idProduct | 2 | XXXXh | Product ID |
12 | bcdDevice | 2 | 0001h | 0.01 |
14 | iManufacturer | 1 | 00h | Unused |
15 | iProduct | 1 | 00h | Unused |
16 | iSerialNumber | 1 | 00h | Unused |
17 | bNumConfigurations | 1 | 01h | One configuration |
Offset | Field | Size | Value | Description |
---|---|---|---|---|
0 | bLength | 1 | 09h | Size of this descriptor |
1 | bDescriptorType | 1 | 02h | Configuration |
2 | wTotalLength | 2 | 0022h | Length of the total configuration block, including this descriptor, in bytes |
4 | bNumInterfaces | 1 | 01h | One interfaces |
5 | bConfigurationValue | 1 | 01h | ID of this configuration |
6 | iConfiguration | 1 | 00h | Unused |
7 | bmAttributes | 1 | A0h | Bus Powered, Remote Wakeup |
4…0: Reserved | . . . 00000 | Unused | ||
5: Remote Wakeup | . .1 . . . . . | Yes | ||
6: Self Powered | . 0 . . . . . . | No, Bus Powered | ||
7: Reserved (set to one) (bus-powered for 1.0) | 1 . . . . . . . | Unused | ||
8 | bMaxPower | 1 | 65h | 202 mA |
Offset | Field | Size | Value | Description |
---|---|---|---|---|
0 | bLength | 1 | 09h | Size of this descriptor |
1 | bDescriptorType | 1 | 04h | INTERFACE |
2 | bInterfaceNumber | 1 | 00h | Index of this interface |
3 | bAlternateSetting | 1 | 00h | Index of this setting |
4 | bNumEndpoints | 1 | 01h | 1 endpoints |
5 | bInterfaceClass | 1 | 03h | HID |
6 | bInterfaceSubClass | 1 | 01h | Boot Interface |
7 | bInterfaceProtocol | 1 | 01h | Keyboard |
8 | iInterface | 1 | 00h | Unused |
Offset | Field | Size | Value | Description |
---|---|---|---|---|
0 | bLength | 1 | 09h | Size of this descriptor |
1 | bDescriptorType | 1 | 21h | HID |
2 | bcdHID | 2 | 0110h | 1.10 |
4 | bCountryCode | 1 | 00h | |
5 | bNumDescriptors | 1 | 01h | |
6 | bDescriptorType | 1 | 22h | Report |
7 | wDescriptorLength | 2 | 006Ah | 106 bytes |
Offset | Field | Size | Value | Description |
---|---|---|---|---|
0 | bLength | 1 | 07h | Size of this descriptor |
1 | bDescriptorType | 1 | 05h | Endpoint |
2 | bEndpointAddress | 1 | 81h | 1 In |
3 | bmAttributes | 1 | 03h | Interrupt |
1…0: Transfer Type | . . . . . .11 | Interrupt | ||
7…2: Reserved | 000000 . . | Unused | ||
4 | wMaxPacketSize | 2 | 0040h | 64 bytes |
6 | bInterval | 1 | 01h | 1 ms |
Item Tag (Value) | Raw Data |
---|---|
Usage Page (Generic Desktop) | 05 01 |
Usage (Keyboard) | 09 06 |
Collection (Application) | A1 01 |
?Usage Page (Keyboard/Keypad) | 05 07 |
?Report ID (3) | 85 03 |
?Usage Minimum (Keyboard Left Control) | 19 E0 |
?Usage Maximum (Keyboard Right GUI) | 29 E7 |
?Logical Minimum (0) | 15 00 |
?Logical Maximum (1) | 25 01 |
?Report Size (1) | 75 01 |
?Report Count (8) | 95 08 |
?Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) | 81 02 |
?Report Count (1) | 95 01 |
?Report Size (8) | 75 08 |
?Input (Cnst,Var,Abs,NWrp,Lin,Pref,NNul,Bit) | 81 03 |
?Report Count (1) | 95 01 |
?Report Size (8) | 75 08 |
?Logical Minimum (0) | 15 00 |
?Logical Maximum (-25) | 25 E7 |
?Usage Page (Keyboard/Keypad) | 05 07 |
?Usage Minimum (Undefined) | 19 00 |
?Usage Maximum (Keyboard LANG1) | 29 90 |
?Input(Data,Ary,Abs) | 81 00 |
?Report ID (3) | 85 03 |
?Report Count (5) | 95 05 |
?Report Size (1) | 75 01 |
?Usage Page (LEDs) | 05 08 |
?Usage Minimum (Num Lock) | 19 01 |
?Usage Maximum (Kana) | 29 05 |
?Output (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) | 91 02 |
?Report Count (1) | 95 01 |
?Report Size (3) | 75 03 |
?Output (Cnst,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) | 91 03 |
End Collection | C0 |
Usage Page (Generic Desktop) | 05 01 |
Usage (Undefined) | 09 10 |
Collection (Application) | A1 01 |
?Usage Page (Keyboard/Keypad) | 05 07 |
?Report ID (186) | 85 BA |
?Usage Minimum (Keyboard Left Control) | 19 E0 |
?Usage Maximum (Keyboard Right GUI) | 29 E7 |
?Logical Minimum (0) | 15 00 |
?Logical Maximum (-1) | 25 FF |
?Report Size (63) | 75 3F |
?Report Count (8) | 95 08 |
?Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) | 81 02 |
?Report ID (186) | 85 BA |
?Report Count (8) | 95 08 |
?Report Size (63) | 75 3F |
?Usage Page (LEDs) | 05 08 |
?Usage Minimum (Num Lock) | 19 01 |
?Usage Maximum (Kana) | 29 05 |
?Output (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) | 91 02 |
End Collection | C0 |
本文链接:https://blog.csdn.net/u012028275/article/details/115569000
cs