Выбрать главу

Table 8.6 shows an example device descriptor for a mouse device. The length of the descriptor is 18 bytes (bLength=18), and the descriptor type is 0x01 (bDescriptorType=0x01). The device supports USB 1.1 (bcdUSB=0x0110). bDeviceClass, bDeviceSubClass, and bDeviceProtocol are set to zero to show that the class information is in the interface descriptor. bMaxPacketSize0 is set to 8 to show that the maximum input and output packet size for endpoint 0 is 8 bytes. The next three bytes identify the device by the vendor ID, product ID, and device version number. The next three items define indexes to strings about the manufacturer, product, and the serial number. Finally, we notice that the mouse device has just one configuration (bNumConfigurations=1).

Table 8.6: Example device descriptor

Offset Field Value Description
0 bLength 18 Size is 18
1 bDescriptorType 0x01 Descriptor type
2 bcdUSB 0x0110 Highest USB supported = USB 1.1
4 bDeviceClass 0x00 Class information in interface descriptor
5 bDeviceSubClass 0x00 Class information in interface descriptor
6 bDeviceProtocol 0x00 Class information in interface descriptor
7 bMaxPacketSize0 8 Maximum packet size
8 idVendor 0x02A XYZ Co Ltd.
10 idProduct 0x1001 Mouse
12 bcdDevice 0x0011 Device release number
14 iManufacturer 0x20 Index to manufacturer string
15 iProduct 0x21 Index of product string
16 iSerialNumber 0x22 Index of serial number string
17 bNumConfigurations 1 Number of possible configurations