fix(q5_max): fix RAW_EPSIZE and via_command_kb hook conflict

Two build errors:

1. RAW_EPSIZE undeclared — usb_descriptor.h is not in scope when
   keymap.c is compiled through Keychron's build path. Replace all
   uses with HID_PACKET_SIZE (= 32), now defined in hid_protocol.h.

2. via_command_kb duplicate symbol — keychron_raw_hid.c already defines
   via_command_kb (non-weak) so we cannot redefine it in keymap.c.

Fix by adding a weak kc_raw_hid_rx_kb() extension hook to
keychron_raw_hid.c (following the same pattern as kc_rgb_matrix_rx).
kc_raw_hid_rx() now calls this hook from its default case instead of
returning false directly. The keymap overrides kc_raw_hid_rx_kb() to
handle our custom HID command range (0x40-0x7E).
This commit is contained in:
2026-04-10 15:10:14 -04:00
parent 6fd5179c55
commit df671b656b
4 changed files with 37 additions and 7 deletions
@@ -63,3 +63,17 @@ enum {
REPORT_RATE_GET,
REPORT_RATE_SET,
};
/**
* Keyboard-level Raw HID extension hook.
*
* Called by kc_raw_hid_rx() for any command ID not handled by Keychron's own
* protocol (0xA0-0xAB range). The default weak implementation returns false
* so that unrecognised commands fall through to VIA.
*
* Override this in your keymap to handle custom command IDs without
* conflicting with Keychron's via_command_kb() definition.
* Return true if the packet was fully handled (including calling
* raw_hid_send() if a reply is needed), false to let VIA process it.
*/
bool kc_raw_hid_rx_kb(uint8_t *data, uint8_t length);