Chapter 11
286
reports, the BIOS sends the HID-specific Set Protocol request to request to use
the boot protocol. When the full HID drivers have been loaded, the driver can
use Set Protocol to cause the device to switch from the boot protocol to the
report protocol, which uses the report formats defined in the report descriptor.
If the HID doesn’t support a boot protocol, bInterfaceSubclass = 00h.
*+&%NCUU&GUETKRVQT
The HID class descriptor (Table 11-2) identifies additional descriptors for HID
communications. The class descriptor has seven or more fields depending on
the number of additional descriptors.
4GRQTV&GUETKRVQTU
A report descriptor defines the format and use of the data in the HID’s reports.
If the device is a mouse, the data reports mouse movements and button clicks.
If the device is a relay controller, the data specifies which relays to open and
close. The descriptor format is flexible enough for use with devices with varied
functions.
A report descriptor is a class-specific descriptor. The host retrieves the descrip-
tor by sending a Get Descriptor request to the interface with the wValue field
containing 22h in the high byte.
Listing 11-2 is a basic report descriptor that defines an Input report, an Output
report, and a Feature report. The device sends two bytes of vendor-defined data
in the Input report. The host sends two bytes of vendor-defined data in the
Output report. The Feature report is two bytes of vendor-defined data that the
host can send to the device or request from the device.
Basic report descriptors similar to this example can serve many HIDs with ven-
dor-specific functions. For a loop-back test, device firmware can copy received
data from an Input report into an Output report to send back to the host. For a
“lights and switches” application, firmware can use received Input report data
to control LEDs and use Output reports to send logic states read at switches.
Each item in the report descriptor consists of a byte that identifies the item and
one or more bytes containing the item’s data. The HID specification defines
item types that a report can contain. Here is the function of each item in the
example report descriptor:
The Usage Page item (06h) specifies the general function of the device, such as
generic desktop control, game control, or alphanumeric display. In the example