Inject
Press and release any inputINJECT sets a momentary input on top of whatever the user is physically doing: a mouse button, a keyboard key or modifier, or a media key. One verb covers all three, tagged by a class byte, so the same press / release logic works for every input class. The continuous axes (cursor and wheel) have their own verb, MOVE.
INJECT
Momentary-usage overrideINJECT sets a per-usage override, the box's own held decision layered over the physical input. The class byte picks the input kind, id picks the usage within that class, and action is the same tri-state for all three. Opcode 0x03.
INJECT 0x03 · payload 4 bytes
Fire-and-forget
| Offset | Field | Type | Notes |
|---|---|---|---|
| 0 | class | u8 | 0=button 1=key 2=media (the input kind) |
| 1 | id | u16 | the usage within the class, little-endian (see each class below) |
| 3 | action | u8 | 0=soft-release 1=press 2=force-release |
| Class | Value | id is |
|---|---|---|
| button | 0 | a semantic button id (0=Left .. 4=Side2) |
| key | 1 | a HID keyboard usage (0xE0-0xE7 = modifier) |
| media | 2 | a 16-bit Consumer usage |
| Action | Value | Effect |
|---|---|---|
| press | 1 | Force the usage active regardless of physical state. |
| soft-release | 0 | Drop our override (whether it was a press or a force-release); a physical hold stays active. |
| force-release | 2 | Force the usage inactive, masking a physical hold too. The release the safety auto-clear uses. |
The two releases differ only when the user is physically holding the same input:
| Action | User holds nothing | User is holding it |
|---|---|---|
press | active | active |
soft-release | inactive | active (physical wins) |
force-release | inactive | inactive (masks physical) |
additive layers over the user at the same merge point as MOVE;
never evicts the user's own input
no click no firmware click or chord; send a press, then your
own client-timed soft-release
RESET releases every override at onceA usage the cloned device can't report is a silent no-op. Check CAPS before you rely on it.
Library binding: inject.
class = key
Keyboard key and modifier overrideWith class = 1, id is a HID keyboard usage. A usage of 0xE0-0xE7 folds into the modifier byte; anything else fills a keycode slot (or sets its NKRO bit) in the report the PC sees. Physical keys keep their slots, so injection never evicts the user's typing; past the board's rollover limit it emits the board's own ErrorRollOver. A keycode the cloned board can't report is a no-op. Library bindings: inject / press / release / force_release.
Press A: class 0x01, id 0x0004, action 0x01:
+--------+--------+--------+--------+--------+--------+--------+--------+ | A5 | 03 | 00 | 04 00 | 01 | 04 00 | 01 | lo hi | +--------+--------+--------+--------+--------+--------+--------+--------+ | SOF | TYPE | SEQ | LEN | class | id | action | CRC16 | +--------+--------+--------+--------+--------+--------+--------+--------+
class = media
Media key overrideWith class = 2, id is a 16-bit Consumer usage (e.g. 0xCD Play/Pause, 0xE9 Volume Up), merged onto the cloned keyboard's Consumer report. Present-gated to a board that declares a Consumer collection, read from the CAPS CONSUMER flag; otherwise a no-op. Library bindings: inject / press / release / force_release.
Press Volume Up: class 0x02, id 0x00E9, action 0x01:
+--------+--------+--------+--------+--------+--------+--------+--------+ | A5 | 03 | 00 | 04 00 | 02 | E9 00 | 01 | lo hi | +--------+--------+--------+--------+--------+--------+--------+--------+ | SOF | TYPE | SEQ | LEN | class | id | action | CRC16 | +--------+--------+--------+--------+--------+--------+--------+--------+