【USB描述符系列】手持式条形扫描器
简介
使用了一款USB接口的手持式条形扫描器,就看了下这个USB设备的描述符是什么样了。从描述符可以看到,这个设备就是枚举成一个HID KeyBoard,和普通的键盘没有什么区别。条形扫描器在扫描获取到信息后,作为HID键盘设备上报了键值。
下面是这个USB接口的手持式条形扫描器的描述符,产品的VID和PID被我隐去了。
Device Descriptor
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 | 0100h | 1.00 |
14 | iManufacturer | 1 | 01h | Index to string descriptor that contains the string < Your Name > in Unicode |
15 | iProduct | 1 | 02h | Index to string descriptor that contains the string < Your Product Name > in Unicode |
16 | iSerialNumber | 1 | 00h | Index to string descriptor that contains the string < Your Serial Number > in Unicode |
17 | bNumConfigurations | 1 | 01h | One configuration |
Configuration Descriptor
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 | 80h | Bus Powered |
| 4…0: Reserved | | . . . 00000 | Unused |
| 5: Remote Wakeup | | . .0 . . . . . | No |
| 6: Self Powered | | . 0 . . . . . . | No, Bus Powered |
| 7: Reserved (set to one) (bus-powered for 1.0) | | 1 . . . . . . . | Unused |
8 | bMaxPower | 1 | 96h | 300 mA |
Interface Descriptor 0/0 HID, 1 Endpoints
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 |
HID Descriptor
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 | 003Fh | 63 bytes |
Endpoint Descriptor 84 4 In, Interrupt, 1 ms
Offset | Field | Size | Value | Description |
---|
0 | bLength | 1 | 07h | Size of this descriptor |
1 | bDescriptorType | 1 | 05h | Endpoint |
2 | bEndpointAddress | 1 | 84h | 4 In |
3 | bmAttributes | 1 | 03h | Interrupt |
| 1…0: Transfer Type | | . . . . . .11 | Interrupt |
| 7…2: Reserved | | 000000 . . | Unused |
4 | wMaxPacketSize | 2 | 0008h | 8 bytes |
6 | bInterval | 1 | 01h | 1 ms |
Interface 0 HID Report Descriptor Keyboard
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 |
?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 (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 |
?Report Count (6) | 95 06 |
?Report Size (8) | 75 08 |
?Logical Minimum (0) | 15 00 |
?Logical Maximum (101) | 25 65 |
?Usage Page (Keyboard/Keypad) | 05 07 |
?Usage Minimum (Undefined) | 19 00 |
?Usage Maximum (Keyboard Application) | 29 65 |
?Input (Data,Ary,Abs) | 81 00 |
End Collection | C0 |
本文链接:https://blog.csdn.net/u012028275/article/details/115567700
cs