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
+6 -1
View File
@@ -85,6 +85,11 @@ void get_firmware_version(uint8_t *data) {
__attribute__((weak)) void kc_rgb_matrix_rx(uint8_t *data, uint8_t length) {}
/* Default no-op implementation; override in keymap.c to handle custom IDs. */
__attribute__((weak)) bool kc_raw_hid_rx_kb(uint8_t *data, uint8_t length) {
return false;
}
bool kc_raw_hid_rx(uint8_t *data, uint8_t length) {
switch (data[0]) {
case KC_GET_PROTOCOL_VERSION:
@@ -185,7 +190,7 @@ bool kc_raw_hid_rx(uint8_t *data, uint8_t length) {
#endif
default:
return false;
return kc_raw_hid_rx_kb(data, length);
}
raw_hid_send(data, length);