From 38a97723649d0104f1610b2ce1b50d9d857d0957 Mon Sep 17 00:00:00 2001 From: afiqzudinhadi Date: Wed, 3 Jun 2026 22:55:00 +0800 Subject: [PATCH] feat: report key matrix and layer over raw HID for keyglance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable RAW_ENABLE and send a report on every physical key event (row, col, pressed) and on layer changes (active layer) via raw_hid_send, so the keyglance overlay can highlight the exact physical keys pressed — including while in steno mode, where the steno protocol otherwise hides which physical keys are down. - rules.mk: RAW_ENABLE = yes - keymap.c: raw_hid_receive stub, kg_send_key/kg_send_layer helpers, process_record_user reports real matrix keys (combos/virtual filtered), layer_state_set_user reports the highest active layer --- .../noll/ecosteno/keymaps/default/keymap.c | 26 ++++++++++++++++++- keyboards/noll/ecosteno/rules.mk | 5 +++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/keyboards/noll/ecosteno/keymaps/default/keymap.c b/keyboards/noll/ecosteno/keymaps/default/keymap.c index 1a3cd51..7dd0e9f 100644 --- a/keyboards/noll/ecosteno/keymaps/default/keymap.c +++ b/keyboards/noll/ecosteno/keymaps/default/keymap.c @@ -17,6 +17,29 @@ #include "keymap_steno.h" #include QMK_KEYBOARD_H +#include "raw_hid.h" +#define KG_REPORT_KEY 0x01 +#define KG_REPORT_LAYER 0x02 +void raw_hid_receive(uint8_t *data, uint8_t length) { (void)data; (void)length; } +static void kg_send_key(uint8_t row, uint8_t col, bool pressed) { + uint8_t report[RAW_EPSIZE] = {0}; + report[0] = KG_REPORT_KEY; report[1] = row; report[2] = col; report[3] = pressed ? 1 : 0; + raw_hid_send(report, sizeof(report)); +} + +static void kg_send_layer(uint8_t layer) { + uint8_t report[RAW_EPSIZE] = {0}; + report[0] = KG_REPORT_LAYER; report[1] = layer; + raw_hid_send(report, sizeof(report)); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.key.row < MATRIX_ROWS && record->event.key.col < MATRIX_COLS) { + kg_send_key(record->event.key.row, record->event.key.col, record->event.pressed); + } + return true; +} + enum layers{ STENO, // NKRO, @@ -547,5 +570,6 @@ layer_state_t layer_state_set_user(layer_state_t state) { break; } + kg_send_layer(get_highest_layer(state)); return state; -} \ No newline at end of file +} diff --git a/keyboards/noll/ecosteno/rules.mk b/keyboards/noll/ecosteno/rules.mk index fae102f..b6a8574 100644 --- a/keyboards/noll/ecosteno/rules.mk +++ b/keyboards/noll/ecosteno/rules.mk @@ -17,4 +17,7 @@ NKRO_ENABLE = yes # USB Nkey Rollover COMBO_ENABLE = yes # Enable Key Combos STENO_ENABLE = yes # Stenography keys STENO_PROTOCOL = geminipr # Can be geminipr or txbolt -MOUSEKEY_ENABLE = no # Mouse keys \ No newline at end of file +MOUSEKEY_ENABLE = no # Mouse keys + +RAW_ENABLE = yes +