Книга: Advanced PIC Microcontroller Projects in C

8.4.4 HID Descriptors

8.4.4 HID Descriptors

An HID descriptor always follows an interface descriptor when the interface belongs to the HID class. Table 8.11 shows the format of the HID descriptor.

 bLength is the length of the device descriptor.

 bDescriptorType is the descriptor type.

 bcdHID is the HID class specification.

 bCountryCode specifies any special local changes.

 bNumDescriptors specifies if there are any additional descriptors associated with this class.

 bDescriptorType is the type of the additional descriptor specified in bNumDescriptors.

 wDescriptorLength is the length of the additional descriptor in bytes.

Table 8.11: HID descriptor

Offset Field Size Description
0 bLength 1 Descriptor size in bytes
1 bDescriptorType 1 HID (0x21)
2 bcdHID 2 HID class
4 bCountryCode 1 Special country dependent code
5 bNumDescriptors 1 Number of additional descriptors
6 bDescriptorType 1 Type of additional descriptor
7 wDescriptorLength 2 Length of additional descriptor

Table 8.12 shows an example HID descriptor for a mouse device. The length of the descriptor is 9 bytes (bLength=9), and the descriptor type is 0x21 (bDescriptorType=0x21). The HID class is set to 1.1 (bcdHID=0x0110). The country code is set to zero (bCountryCode=0), specifying that there is no special localization with this device. The number of descriptors is set to 1 bNumDescriptors=1) which specifies that there is one additional descriptor associated with this class. The type of the additional descriptor is REPORT (bDescriptorType=REPORT), and its length is 52 bytes (wDescriptorLength=52).

Table 8.12: Example HID descriptor

Offset Field Value Description
0 bLength 9 Descriptor size is 9 bytes
1 bDescriptorType 0x21 HID (0x21)
2 bcdHID 0x0110 Class version 1.1
4 bCountryCode 0 No special country dependent code
5 bNumDescriptors 1 Number of additional descriptors
6 bDescriptorType REPORT Type of additional descriptor
7 wDescriptorLength 5 Length of additional descriptor

Оглавление книги


Генерация: 1.491. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз