Usage IDs
INJECT and LOCK name an input by an id, per class: a button id for the mouse, a HID keyboard usage for a key, or a 16-bit Consumer usage for a media key.
Button ids Mouse buttons (class = button)
A semantic id, bound to the mouse's buttons at clone time and shared by INJECT and LOCK. The first five are named. Each further declared button gets a numeric id, up to CAPS n_buttons. An id past that count is a no-op, so read n_buttons first.
| Button | id |
|---|---|
| Left | 0 |
| Right | 1 |
| Middle | 2 |
| Side1 (first thumb) | 3 |
| Side2 (second thumb) | 4 |
| further declared buttons | 5 .. n_buttons - 1 |
The Rust library names the five as Button constants (Button::LEFT to Button::SIDE2) and takes further ids up to the declared count.
HID keyboard usages Keys and modifiers (class = key)
A HID Keyboard/Keypad usage from the USB HID Usage Tables (page 0x07). 0xE0-0xE7 are modifiers and fold into the modifier byte. Any other usage fills a keycode slot. Common ones:
| Key | Usage |
|---|---|
A .. Z | 0x04 .. 0x1D |
1 .. 9 | 0x1E .. 0x26 |
0 | 0x27 |
| Enter / Escape / Backspace / Tab | 0x28 / 0x29 / 0x2A / 0x2B |
| Space | 0x2C |
| Caps Lock | 0x39 |
F1 .. F12 | 0x3A .. 0x45 |
| Insert / Home / Page Up | 0x49 / 0x4A / 0x4B |
| Delete / End / Page Down | 0x4C / 0x4D / 0x4E |
| Right / Left / Down / Up | 0x4F / 0x50 / 0x51 / 0x52 |
| Modifier | Usage |
|---|---|
| Left Ctrl / Shift / Alt / GUI | 0xE0 / 0xE1 / 0xE2 / 0xE3 |
| Right Ctrl / Shift / Alt / GUI | 0xE4 / 0xE5 / 0xE6 / 0xE7 |
The Rust library exposes these as named Key constants (Key::A, Key::LEFT_SHIFT, ...).
Consumer usages Media keys (class = media)
A 16-bit usage from the Consumer page (0x0C) of the USB HID Usage Tables. Available only on a board with a Consumer collection (the CAPS CONSUMER flag). Common transport controls:
| Media key | Usage |
|---|---|
| Play / Pause toggle | 0x00CD |
| Play | 0x00B0 |
| Pause | 0x00B1 |
| Stop | 0x00B7 |
| Next track | 0x00B5 |
| Previous track | 0x00B6 |
| Mute | 0x00E2 |
| Volume up | 0x00E9 |
| Volume down | 0x00EA |
The Rust library exposes these as named MediaKey constants (MediaKey::VOLUME_UP, ...).