A Report Descriptor is a somewhat complicated (but compact) structure detailing the device's capabilities. It may describe more than one report. A parser is provided by Windows to make sense of the format.
A Report Descriptor is a variable length structure made up of
Overview
A Report descriptor usually has an Application collection defining one or more reports. Each report describes the input, output, or feature controls, and collections that it contains.
Each control has a data size and a usage. Controls can be given units, ranges, and scaling exponents. The data structure allows more than one control to be given usages, units, and exponents easily.
Table 22.3 Keyboard modifier keys example
Item | Item data | Item Type | ActualBytes |
---|---|---|---|
Usage Page | 'keyboard' | Global | 05 07 |
Usage Minimum | 'left control key' | Local | 19 E0 |
Usage Maximum | 'left alt key' | Local | 29 E2 |
Report Size | 1 | Global | 75 01 |
Report Count | 3 | Global | 95 03 |
Input | (Data, Variable, Absolute) | Main | 81 02 |
As an example, Table 22.3 shows how three single-bit input controls are specified, the first three modifier keys on a keyboard. The last item, Input, declares the control(s) and states that they are data values (i.e., not constants). Preceding items give more details of the control(s). The preceding Report Size item says that each control has 1 bit and the Report Count item says that there are 3 controls. The preceding Usage Page item specifies the 'keyboard' usage page, while the Usage Minimum and Usage Maximum items say that the first input bit corresponds to the left control key of a keyboard and that the last is the left Alt key.
Note that the Item data is actually a byte (e.g., 'keyboard' is the constant 07, HID_USAGE_PAGEKEYBOARD).
Item Parts
An item consists of one or more bytes that define an
An item may be in Short or Long format. Long format is not used yet, so it is not discussed here.
Figure 22.3 shows that the first byte of an item has a Tag of four bits, a Type of two bits and a Data size of two bits. Table 22.4 shows the interpretation of the size and type fields.
Figure 22.3 Short item format
Table 22.4 Short item values
Data Size | 0 = 0 bytes |
1 = 1 byte | |
2 = 2 bytes | |
3 = 4 bytes | |
Type | 0 = Main |
1 = Global | |
2 = Local | |
3 = Reserved |
Main Item Tags