keys are pressed and which modifier keys are pressed (i.e., Shift, etc.).

A control is a value of one or more bits. Control values can be converted from logical to physical form (i.e., scaled and given units). (Windows refers to some controls as buttons, while it calls others values.).

Reports may be grouped together in Collections. An Application top-level collection usually describes all the reports that a device can produce. More than one Application collection can be given. For example, if a keyboard has a built-in pointer (i.e., a mouse), it might well have an Application collection for a keyboard report and an Application collection for a pointer report. Reports and collections may contain other collections.

Figure 22.2 shows an overview of the Report descriptor for a HID keyboard. An input report contains eight control bits for the modifier keys and six byte values for all the keys that are simultaneously pressed. An output report just contains five output control bits for the keyboard LEDs. The full keyboard report descriptor also contains a 'reserved' input control byte and a 3-bit control that pads out the output report.

Figure 22.2 Keyboard report descriptor overview

Usages

A HID device needs a standard way to tell programmers what their device is: what Input. Output, and Feature reports it can send and receive. Discovering this information is known as getting a device's capabilities.

Each control or collection of controls is assigned a usage that describes its purpose. The HID Specifications list a large number of usages for a range of standard devices. (I have yet to see a device with a 'Do Not Disturb' LED. Did you know that a magic carpet has standard controls?)

A usage is, in fact, represented by two bytes: a Usage Page and a Usage. Table 22.1 shows the main usage categories.

Table 22.1 Main Usage categories

Usage Page Usage
Generic Desktop pointer
mouse
pen
joystick
gamepad
keyboard
keypad
Vehicle rudder
throttle
Virtual Reality
Sport
Game
Consumer power amp
video disk
Keyboard all keys
LED NumLock
CapsLock
ScrollLock
power
Button
Ordinal
Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату
×