Medius - Native APIUsage IDs

Usage IDs

The id numbers inject and lock take

INJECT and LOCK both name an input by an id, and the numbers depend on the class: a button id for the mouse, a HID keyboard usage for a key, or a 16-bit Consumer usage for a media key. They're gathered here so the command pages stay short.

Button ids

Mouse buttons (class = button)

A small semantic id, bound at clone time to the real mouse's buttons, and the same id for INJECT and LOCK (a button locks as class = 0, id = button id, the same (class, id) form a key or media usage takes). A command for an id the mouse lacks is a no-op, so read CAPS n_buttons first.

Buttonid
Left0
Right1
Middle2
Side1 (first thumb)3
Side2 (second thumb)4

The Rust library exposes these as the named Button enum (Button::Left, Button::Side2, ...).

HID keyboard usages

Keys and modifiers (class = key)

The id is a HID Keyboard/Keypad usage from the USB HID Usage Tables (page 0x07). A usage of 0xE0-0xE7 is a modifier and folds into the modifier byte; any other usage fills a keycode slot. The common ones:

KeyUsage
A .. Z0x04 .. 0x1D
1 .. 90x1E .. 0x26
00x27
Enter / Escape / Backspace / Tab0x28 / 0x29 / 0x2A / 0x2B
Space0x2C
Caps Lock0x39
F1 .. F120x3A .. 0x45
Insert / Home / Page Up0x49 / 0x4A / 0x4B
Delete / End / Page Down0x4C / 0x4D / 0x4E
Right / Left / Down / Up0x4F / 0x50 / 0x51 / 0x52
MODIFIERS
ModifierUsage
Left Ctrl / Shift / Alt / GUI0xE0 / 0xE1 / 0xE2 / 0xE3
Right Ctrl / Shift / Alt / GUI0xE4 / 0xE5 / 0xE6 / 0xE7

The Rust library exposes these as named Key constants (Key::A, Key::LEFT_SHIFT, ...).

Consumer usages

Media keys (class = media)

The id is a 16-bit usage from the Consumer page (0x0C) of the USB HID Usage Tables. Present-gated to a board with a Consumer collection, read from the CAPS CONSUMER flag. The usual transport controls:

Media keyUsage
Play / Pause toggle0x00CD
Play0x00B0
Pause0x00B1
Stop0x00B7
Next track0x00B5
Previous track0x00B6
Mute0x00E2
Volume up0x00E9
Volume down0x00EA

The Rust library exposes these as named MediaKey constants (MediaKey::VOLUME_UP, ...).