Handle differences in supported features protocol packet between Keychron QMK and ZMK

This commit is contained in:
Adam Honse
2026-07-07 01:34:16 -05:00
parent 0973f6149b
commit 3818398d86

View File

@@ -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