INJECTMomentary-usage override

INJECT sets a per-usage override, a held level layered over native input. Opcode 0x03.

INJECT 0x03 · payload 4 bytes

Fire-and-forget

PAYLOAD
OffsetFieldTypeNotes
0classu80=button 1=key 2=media (the input kind)
1idu16usage within the class, little-endian (see below)
3actionu80=soft-release 1=press 2=force-release
CLASSES
NameValueid is
button0a semantic button id (0=Left .. 4=Side2, then numeric to the declared count)
key1a HID keyboard usage (0xE0-0xE7 = modifier)
media2a 16-bit Consumer usage
ActionValueEffect
press1Force the usage active regardless of native state.
soft-release0Drop the override (press or force-release). A hold on the real device stays active.
force-release2Force the usage inactive, masking a hold on the real device too. The safety auto-clear uses it.
EMITTED STATE

The releases differ only while the same input is held on the real device:

ActionNot heldHeld
pressactiveactive
soft-releaseinactiveactive (native bit relayed)
force-releaseinactiveinactive (masks native)
RULES
additive   layers over native input at the same merge point as
           MOVE; never evicts it
no click   no firmware click or chord; send a press, then a
           client-timed soft-release
RESET      releases every override at once

If the cloned device can't report a usage, injecting it changes no report field. Check CAPS first.

Library binding: inject.

class = buttonMouse button override

With class = 0, id is a semantic button id: 0=Left, 1=Right, 2=Middle, 3=Side1, 4=Side2, then numeric ids up to the CAPS count. The five named ids are bound to the mouse's buttons at clone time. The override sets that button's bit in the emitted report.

Injecting a declared but unwired button is descriptor-faithful: the box drives every declared button. An id past the declared count reaches no report field, like an unmapped key.

Library bindings: inject / press / release / force_release.

EXAMPLE

Press Left: class 0x00, id 0x0000, action 0x01:

A5SOF
03TYPE
00SEQ
04 00LEN
00class
00 00id
01action
lo hiCRC16

class = keyKeyboard key and modifier override

With class = 1, id is a HID keyboard usage. 0xE0-0xE7 fold into the modifier byte. Anything else fills a keycode slot (or sets its NKRO bit) in the emitted report.

Native keys keep their slots, so injection never evicts them. Past the board's rollover limit, the box emits ErrorRollOver, as the board does. A keycode the cloned board can't report is a no-op. Library bindings: inject / press / release / force_release.

EXAMPLE

Press A: class 0x01, id 0x0004, action 0x01:

A5SOF
03TYPE
00SEQ
04 00LEN
01class
04 00id
01action
lo hiCRC16

class = mediaMedia key override

With 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.

Has an effect only if the board declares a Consumer collection (the CAPS CONSUMER flag). Library bindings: inject / press / release / force_release.

EXAMPLE

Press Volume Up: class 0x02, id 0x00E9, action 0x01:

A5SOF
03TYPE
00SEQ
04 00LEN
02class
E9 00id
01action
lo hiCRC16