HID Message Formats
This page is part of the HID Protocol Reference.
Message formats
Section titled “Message formats”Offsets are into the 64-byte report (see Report format). [0] is always
0x50 and [1] the command ID, so the tables start at [2]. A reply’s [2] is the
status byte (. / !) unless the table says otherwise. u16 and u32 are
little-endian. “—” means no payload.
Identity and language
Section titled “Identity and language”| ID | Request [2..] |
Reply [3..] |
|---|---|---|
0x06 GET_ID |
— | Status [2] is * instead of . on the first GET_ID after a boot. ASCII <board> <fw version> P<protocol> HW<hw version> , NUL; then V, n, n × u16 font-pack bundle versions; then G, u16 state generation. A block that does not fit is left out whole. |
0x07 GET_LANG |
— | [3..6] language code, 4 ASCII (deDE) |
0x09 CHANGE_LANG |
[2..5] language code, 4 ASCII |
— (! if unknown) |
0x16 GET_DEFAULT_LAYER |
— | [3] default layer |
0x32 HW_ID |
— | v37+. [3] flags: bit 0 = [4..11] is valid, bit 1 = [12..19] is valid; [4..11] the unique ID of the flash chip of the half the host talks to, 8 bytes in the order the chip sends them; [12..19] the ID of the other half. The status is always .: a half that is not connected, runs firmware before v37 or has no usable ID has its flag bit clear. Firmware before v37 answers !. |
0x1B GET_LANG_LIST_PACKED |
— | Several replies, each [3..63] up to 61 bytes. Joined: count, then count × (ISO 639-1 index, ISO 3166-1 index), indices into the frozen table iso_lang_country.py. |
Settings
Section titled “Settings”| ID | Request [2..] |
Reply [3..] |
|---|---|---|
0x0B OVERLAY_FLAGS on |
[2] flags to set: bit 0 show overlays, 1 map all, 2 mirror to both halves, 5 reset buffers, 6 reset usage, 7 reset mapping |
— |
0x0C OVERLAY_FLAGS off |
[2] flags to clear, same bits |
— |
0x0D SET_BRIGHTNESS |
[2] level 0..50; [3] flags: bit 0 volatile, bit 1 auto on, bit 2 auto off |
— (! if level > 50) |
0x0E KEYPRESS |
[2..3] keycode, big-endian; [4] 0 press, else release |
— (! unless debug mode is on, see below) |
0x0F IDLE_STATE |
[2] 0 wake, else start idle |
— |
0x14 SET_UNICODE_MODE |
[2] 0 Linux, 1 macOS, 2 Windows, 3 WinCompose, 4 BSD, 6 MacCompose (v38); [3] non-zero = this session only (v17) |
— (! for 5, for 7 and up, and for 6 before v38) |
0x17 BOOTLOADER |
— | — then the keyboard enters the bootloader |
0x18 DISPLAY_OFF |
— | — |
0x19 SET_HANDEDNESS |
[2] 0 = the USB half is left, else right; [3] (v24) Rev.2 mark of the USB half: 0 keep, 1 remove, 2 set |
— then both halves reboot (! if [3] > 2) |
0x1A SAVE_MRU |
— | — (writes unsaved settings to EEPROM) |
0x1C IDLE_STYLE |
[2] 0xFF query, or 0 pulse, 1 jitter, 2 DOOM demo, 3 Eden |
[3] style |
0x1D SET_OS |
[2] 0xFF query, 0xFE auto, or OS: 0 unknown, 1 Windows, 2 macOS, 3 Linux, 4 Android, 6 GNOME, 7 KDE; [3] bit 0 = pin (manual) |
[3] active OS, [4] 1 if auto |
0x1E GLYPH_SCRIPT |
[2] 0xFF query (or, with a placement op, keep the script), or script 0..0xFE (any value accepted); since v26 [3] placement op: 0 keep, 1 centre, 2 top-left, 3 and up refused |
[3] script; since v26 [4] placement (0 centre, 1 top-left) |
0x1F REPLAY_ANIM |
— | — |
0x20 PROFILER |
[2] 0 reset, 1 read, 2 log; [3] page (read) |
[3] page, [4..] snapshot. Profiler builds only; others answer !. See Main-Loop Profiler. |
0x22 GLYPH_SIZE |
[2] 0xFF query, or 0 small, 1 medium, 2 large |
[3] size (! if out of range) |
0x23 GET_LAYER_NAMES |
— | See Layer names |
0x28 IDLE_TIMEOUT |
[2] 0xFF query, or preset 0..5 (15 s, 30 s, 45 s, 1 min, 2 min, 5 min) |
[3] preset, [4..5] u16 seconds (! if out of range) |
0x2C TAP_TERMS |
[2] 0 query, 1 set; [3..4] u16 tapping term ms; [5..6] u16 Flow Tap term ms; 0xFFFF keeps a term. v30: [7] Auto Shift 0 keep, 1 off, 2 on; [8..9] u16 Auto Shift timeout ms, 0 keeps it |
[3..4] tapping term, [5..6] Flow Tap term, [7] bit 0 = this firmware has Flow Tap, bit 1 = has Auto Shift (v30), bit 2 = Auto Shift is on; [8..9] Auto Shift timeout (on ! too) |
0x2D AI |
[2] op: 0 query; 1 set keys: [3..12] state of keys 1..0 (0 empty, 1 working, 2 waiting, 3 done, 4 idle, 5 stale), [13] flags (bit 0 Esc attention, bit 1 more than one page, bit 2 an agent waits, bit 3 the -/+ cards are set), [14..37] 12 u16 pool slots (keys 1..0, -, +; 0xFFFF no card), v36+: [38] page (0-based), [39] page count (0 = no page, the v35 behaviour), [40] finished-elsewhere counter; 2 read events: [3] last seq seen |
op 0: [3] AI mode, [4] newest event seq, [5] number keys found, [6] Esc found. op 1: no data. op 2: [3] newest seq, [4] count (0..8), then (seq, key) pairs, oldest first; key 0..8 keys 1 to 9, 9 key 0 (the same order as the states), 10 Esc, 11 -, 12 = (+), v36+: 13 AI mode left with more than one page |
0x2E AI_CARD |
[2..3] u16: bits 0..9 pool slot, bits 12..14 segment 0..5; [4..63] the 60-byte segment |
— (! for a slot of 600 or more, a segment past 5, or a segment the other half did not confirm) |
0x2F KEY_ATTENTION |
[2] 0 start, 1 cancel; start: [3] row, [4] col (matrix position), [5] ripple count (0 until cancelled), [6] period in 100 ms, 23..100 |
— (! for a key without a display or a value out of range) |
0x31 HOST_TUTORIAL |
[2] op: 0 INFO; 1 TEXT: [3] length of line 1, then line 1, then the length of line 2 and line 2 (ASCII 0x20..0x7E, both lengths 0 clear the text, at most 59 bytes together); 2 SPOTLIGHT: [3] bit 0 on, [4..13] key mask, bit = row × columns + col; 3 REVEAL: [3] row, [4] col; 4 ARM: [3] count 0..4, then {kind, a, b} per condition: 1 key (a row, b col), 2 layer on (a layer, b 0), 3 keycode pressed (a low byte, b high byte); 5 POLL; 6 END |
op 0: [3] op bitmask, [4] most conditions, [5] watchdog s, [6] text bytes. op 5: [3] bit 0 text shown, bit 1 spotlight on, bit 2 armed; [4] armed count; [5] matched bits (one per condition, kept until the next ARM); [6] highest active layer. Other ops: no data (! for a value out of range) |
KEYPRESS makes the keyboard type into whatever app has focus, so any program that can
talk raw HID could use it to inject keystrokes. The firmware therefore refuses it unless
debug mode is on. Debug mode is off at every boot and is switched on with the DB_TOGG
key on the settings layer, which needs a physical key press on the keyboard.
MacCompose
Section titled “MacCompose”SET_UNICODE_MODE value 6 (v38) is the macOS mode with one difference: while the keyboard
types the hex digits of a character, it holds F20 instead of Option. The host reads the digits
between F20 down and F20 up, removes them and types the character, so Unicode input works with
every macOS input source. The plain macOS mode needs the Unicode Hex Input source.
- The keyboard keeps MacCompose in RAM only. A set with
[3]zero stores the plain macOS mode, so a keyboard used on a Mac without the host types Option + hex digits again. - Any other change of the unicode mode ends MacCompose: another
SET_UNICODE_MODEvalue or a unicode-mode key on the keyboard. - A character above U+FFFF is typed as a UTF-16 surrogate pair (8 hex digits), as in the macOS mode.
- Value
5is not a mode. The host uses that number for “unknown” and never sends it, and the keyboard refuses it. - Firmware before v38 refuses value
6, so the host sends it only from v38.
Macros and crash record
Section titled “Macros and crash record”| ID | Request [2..] |
Reply [3..] |
|---|---|---|
0x24 MACRO_INFO |
— | [3] macro count, [4] max label length, [5..6] u16 buffer capacity, [7..8] u16 bytes used, [9] keycap styles drawn |
0x25 MACRO_BODY |
[2] 0 read, 1 write; [3..4] u16 offset; [5] count (≤ 58); [6..] bytes (write) |
Read: [3] count, [6..] bytes. Write: status only. |
0x26 MACRO_LABEL |
[2] macro id; [3] 0xFF query, else caption length; [4] style; [5..8] u32 icon code point; [9..] caption, ASCII |
Same layout from [3]: length, style, icon, caption |
0x27 CRASH_RECORD |
[2] 0 this half, 1 other half, 2 clear |
[3] flags: bit 0 present, bit 1 fresh; [4..51] record (below) |
The 48-byte crash record, from [4]:
| Offset | Type | Field |
|---|---|---|
+0 |
u32 |
magic |
+4 |
u8 × 4 |
kind (1 HardFault, 2 unhandled interrupt, 3 watchdog, 4 halt), core, consecutive count, reset reason |
+8 |
u32 × 6 |
pc, lr, sp, xpsr, icsr, uptime in ms |
+32 |
u16 × 2 |
phase, phase argument |
+36 |
8 chars | firmware version, NUL-padded |
+44 |
u32 |
CRC-32 of the 44 bytes before it |
Overlay uploads
Section titled “Overlay uploads”No reply, except 0x2A. A keycap image is 72 × 40 pixels, 360 bytes: row-major,
9 bytes per row, most significant bit = leftmost pixel, 1 = lit. keycode is the HID
usage of the key (KC_A … KC_RGUI); mod is the modifier variant 0..15 from
Overlay addressing.
| ID | Report layout |
|---|---|
0x0A SEND_OVERLAY |
[2] keycode; [3] bits 0–3 mod, bits 4–7 segment 0..5; [4..63] bytes 60 × segment to 60 × segment + 59 of the image |
0x10 START_COMPRESSED |
[2] keycode; [3] mod; [4..63] first 60 bytes of the RLE stream |
0x11 SEND_COMPRESSED |
[2..63] next 62 bytes of the RLE stream |
0x12 START_ROI |
[2] keycode; [3..6] ROI header (below); [7..63] first 57 bytes of ROI data |
0x13 SEND_ROI |
[2..63] next 62 bytes of ROI data |
0x15 SEND_OVERLAY_MAPPING |
[2..63] 10-bit values, packed least significant bit first |
0x21 SEND_OVERLAY_MAPPING_W |
[2] bits 0–4 width 8..16, bit 5 show after, bit 6 prepare before, bit 7 dim (mapping flags); [3..63] values of that width, packed least significant bit first; since v25 a to of 600–1199 is slot to − 600 drawn without the legend |
0x29 SEND_PRC_OVERLAY |
[2..63] PRC records |
0x2A FILL_POOL_FROM_ICON |
[2] width 8..16, with no flag bits (a set bit 5 or 6 makes the width out of range and the report is refused); [3..63] (pool slot, icon id) pairs, packed least significant bit first. Reply: . if every pair applied, else ! and [3] = index of the first pair the host must upload as a bitmap. |
The mapping values come in pairs: an overlay index, then the pool slot it shows. A report that has fewer pairs than it holds is padded by repeating the last pair.
ROI header, [3..6] of 0x12. top/left are the first row and column, bottom/right
the row and column one past the end:
| Byte | Bits 7–4 | Bits 3–2 | Bits 1–0 |
|---|---|---|---|
[3] |
top bits 5–2 |
mod bits 3–2 |
mod bits 1–0 |
[4] |
bottom bits 5–2 |
bottom bits 1–0 |
top bits 1–0 |
[5] |
left (bits 6–0) |
||
[6] |
bit 7: data is RLE-coded; bits 6–0: right |
ROI data is the rectangle’s pixels, row-major, packed with no padding between rows, most significant bit first.
Firmware update and font packs
Section titled “Firmware update and font packs”| ID | Request [2..] |
Reply |
|---|---|---|
0x40 FW_UP_BEGIN |
[2..5] u32 image size; [6..9] u32 CRC-32 (zlib) |
[2] . ready, ~ still erasing (send again), ! invalid size |
0x41 FW_UP_CHUNK |
[2..5] u32 offset; [6..61] 56 bytes |
., or ! and [3..6] u32 offset to resume from |
0x45 FW_UP_SIGNATURE |
[2] part 0 or 1; [3..34] 32 signature bytes |
status |
0x42 FW_UP_COMMIT |
[2] x cancels a pending prompt, else 0 |
[2] . accepted, ? waiting for the keypress (send again), S not validly signed, ! CRC mismatch |
0x43 FW_UP_GET_VERSION |
— | [3..18] version, ASCII, NUL-padded; [19..22] u32 size; [23..26] u32 CRC |
0x44 FW_UP_APPLY |
— | . then both halves install and reboot; ! nothing valid staged |
0x50 FONTPACK_BEGIN |
[2..5] u32 size; [6..9] u32 CRC-32; [10] target: bundle slot 0..9 (9 is the emoji-search dictionary), 0x7F DOOM WAD, 0x7E DOOM engine pack |
[2] . / ~ / !, as 0x40 |
0x51 FONTPACK_CHUNK |
As 0x41 |
As 0x41 |
0x52 FONTPACK_COMMIT |
— | [2] . both halves done, R rejected, L the other half did not confirm (send again); [3..4] u16 content version (font bundles) |
0x53 FONTPACK_STATUS |
— | [3] 1 if a pack is present, [4] ABI version, [5..6] u16 content version, [7] font count |
QMK keymap commands
Section titled “QMK keymap commands”These follow QMK’s dynamic-keymap protocol: there is no P, [0] is the command, and
multi-byte values are big-endian. The reply is the request echoed back, with read
data filled in. Commands not listed get no reply.
Since v39 (firmware 1.13.40) the keyboard also answers the four ids below. The ids and
their layout are taken from the VIA protocol. A value id or channel the keyboard does not
know is answered with [0] set to 0xFF. Firmware before
v39 sends no reply to these four ids.
[0] |
Command | Request | Reply |
|---|---|---|---|
0x02 |
get keyboard value | [1] 0x01 uptime |
[2..5] milliseconds since boot of the USB half. Wraps to 0 after about 49.7 days |
0x02 |
get keyboard value | [1] 0x03 switch matrix, [2] first row |
[3..] one byte per row from the first row to the last (at most 28, in [3..30]), bit n = column n. Answered only while debug mode is on (DB_TOGG), otherwise 0xFF |
0x03 |
set keyboard value | [1] 0x05 device indication, [2] call index |
echo. Toggles the RGB matrix once |
0x07 |
set custom value | [1] 3 (RGB matrix), [2] value id, [3..] value |
echo |
0x08 |
get custom value | [1] 3 (RGB matrix), [2] value id |
[3..] value |
RGB matrix value ids: 1 brightness (0–255), 2 effect (0 = off; any other number
switches the lights on with that effect; a number past the built effects is set to the
last one, which a following read returns), 3 speed (0–255), 4 colour ([3] hue,
[4] saturation). The keyboard keeps these changes until it restarts; it stores none of
them.
The original QMK keymap commands:
[0] |
Command | Request | Reply |
|---|---|---|---|
0x05 |
set keycode | [1] layer, [2] row, [3] column, [4..5] keycode |
echo |
0x06 |
reset keymap | — | echo |
0x11 |
get layer count | — | [1] count of remappable layers |
0x12 |
get buffer | [1..2] byte offset, [3] size (≤ 60) |
[4..] keymap bytes |
0x13 |
set buffer | [1..2] byte offset, [3] size (≤ 60), [4..] bytes |
echo |
The keymap buffer is layer × rows × columns keycodes, 2 bytes each, big-endian, as in
upstream QMK.