Get Keychron firmware version

This commit is contained in:
Adam Honse
2026-06-28 01:27:22 -05:00
parent c476ee46f8
commit 7627466891
2 changed files with 24 additions and 1 deletions

View File

@@ -88,6 +88,11 @@ QMKKeychronController::QMKKeychronController(hid_device* dev_handle, const char
\*-----------------------------------------------------*/
CmdGetKeychronProtocolVersion(&kc_protocol_version);
/*-----------------------------------------------------*\
| Get Keychron firmware version |
\*-----------------------------------------------------*/
kc_firmware_version = CmdGetKeychronFirmwareVersion();
/*-----------------------------------------------------*\
| Get supported Keychron features |
\*-----------------------------------------------------*/
@@ -172,7 +177,8 @@ std::string QMKKeychronController::GetVersion()
\*-----------------------------------------------------*/
return("VIA: " + std::to_string(via_protocol_version) + "\r\n" +
"Keychron: " + std::to_string(kc_protocol_version) + "\r\n" +
"Keychron RGB: " + std::to_string(kc_rgb_protocol_version));
"Keychron RGB: " + std::to_string(kc_rgb_protocol_version) + "\r\n" +
"Keychron FW: " + kc_firmware_version);
}
bool QMKKeychronController::GetSupported()
@@ -256,6 +262,21 @@ unsigned short QMKKeychronController::CmdGetKeycode
return(keycode);
}
std::string QMKKeychronController::CmdGetKeychronFirmwareVersion()
{
char response[30];
ViaSendCommand(KC_GET_FIRMWARE_VERSION, NULL, 0, (unsigned char*)response, sizeof(response));
/*-----------------------------------------------------*\
| Ensure response null termination |
\*-----------------------------------------------------*/
response[29] = 0;
return(std::string(response));
}
void QMKKeychronController::CmdGetKeychronProtocolVersion
(
unsigned char* kc_protocol_version