From 3818398d86e59584c5b6e96e7271cc08ba494b74 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Tue, 7 Jul 2026 01:34:16 -0500 Subject: [PATCH] Handle differences in supported features protocol packet between Keychron QMK and ZMK --- .../QMKKeychronController.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Controllers/QMKController/QMKKeychronController/QMKKeychronController.cpp b/Controllers/QMKController/QMKKeychronController/QMKKeychronController.cpp index 76b9e9609..6cca6dd93 100644 --- a/Controllers/QMKController/QMKKeychronController/QMKKeychronController.cpp +++ b/Controllers/QMKController/QMKKeychronController/QMKKeychronController.cpp @@ -335,12 +335,22 @@ void QMKKeychronController::CmdGetNumberLEDs void QMKKeychronController::CmdGetSupportFeature(unsigned short* supported_features) { - ViaSendCommand(KC_GET_SUPPORT_FEATURE, NULL, 0, (unsigned char*)supported_features, sizeof(unsigned short)); + unsigned char response[3]; + + ViaSendCommand(KC_GET_SUPPORT_FEATURE, NULL, 0, response, sizeof(response)); /*-----------------------------------------------------*\ - | The supported features byte order is reversed | + | The QMK and ZMK variants of this packet differ by one | + | byte position | \*-----------------------------------------------------*/ - *supported_features = ((*supported_features & 0x00FF) << 8) | ((*supported_features & 0xFF00) >> 8); + if(response[0] == 0) + { + *supported_features = (response[2] << 8) | response[1]; + } + else + { + *supported_features = (response[1] << 8) | response[0]; + } } void QMKKeychronController::CmdGetViaProtocolVersion