Add Keychron J2 HE 8K support to QMKKeychronController

This commit is contained in:
Raulkong898
2026-08-05 01:59:28 -05:00
committed by Adam Honse
parent 71cd411ffc
commit 6ec5a955df
3 changed files with 14 additions and 6 deletions
@@ -135,6 +135,7 @@ QMKKeychronController::QMKKeychronController(hid_device* dev_handle, const char
dev = dev_handle;
location = path;
kc_protocol_version = 0;
kc_rgb_protocol_version = 0;
pid = dev_pid;
supported_features = 0;
via_protocol_version = 0;
@@ -207,16 +208,17 @@ QMKKeychronController::QMKKeychronController(hid_device* dev_handle, const char
\*-----------------------------------------------------*/
CmdGetSupportFeature(&supported_features);
/*-----------------------------------------------------*\
| Get Keychron RGB protocol version, ahead of the |
| GetSupported() gate below since it needs the result |
\*-----------------------------------------------------*/
CmdGetKeychronRGBProtocolVersion(&kc_rgb_protocol_version);
if(!GetSupported())
{
return;
}
/*-----------------------------------------------------*\
| Get Keychron RGB protocol version |
\*-----------------------------------------------------*/
CmdGetKeychronRGBProtocolVersion(&kc_rgb_protocol_version);
/*-----------------------------------------------------*\
| Get count of LEDs |
\*-----------------------------------------------------*/
@@ -307,7 +309,11 @@ std::string QMKKeychronController::GetVersion()
bool QMKKeychronController::GetSupported()
{
return(supported_features & KC_FEATURE_KEYCHRON_RGB);
/*-----------------------------------------------------*\
| Some boards don't set the feature bit even though the |
| RGB sub-protocol responds, so fall back to that |
\*-----------------------------------------------------*/
return((supported_features & KC_FEATURE_KEYCHRON_RGB) || (kc_rgb_protocol_version != 0));
}
unsigned short QMKKeychronController::GetKeycode(unsigned short led_index)
@@ -102,6 +102,7 @@
#define KEYCHRON_K10_V2_ANSI_RGB_PID 0x0DA0
#define KEYCHRON_K10_V2_ISO_RGB_PID 0x0DA1
#define KEYCHRON_K10_V2_JIS_RGB_PID 0x0DA2
#define KEYCHRON_J2_HE_8K_ANSI_PID 0x0416
#define KEYCHRON_K11_MAX_ANSI_ENCODER_RGB_PID 0x0AB3
#define KEYCHRON_K11_MAX_ISO_ENCODER_RGB_PID 0x0AB4
#define KEYCHRON_K11_MAX_JIS_ENCODER_RGB_PID 0x0AB5
@@ -53,6 +53,7 @@ REGISTER_HID_DETECTOR_IPU("Keychron C3 Pro", DetectQMKKeychronControllers
REGISTER_HID_DETECTOR_IPU("Keychron C3 Pro 8K", DetectQMKKeychronControllers, KEYCHRON_VID, KEYCHRON_C3_PRO_8K_ANSI_PID, 1, KEYCHRON_QMK_USAGE_PAGE, KEYCHRON_QMK_USAGE);
REGISTER_HID_DETECTOR_IPU("Keychron C3 Pro 8K", DetectQMKKeychronControllers, KEYCHRON_VID, KEYCHRON_C3_PRO_8K_ISO_PID, 1, KEYCHRON_QMK_USAGE_PAGE, KEYCHRON_QMK_USAGE);
REGISTER_HID_DETECTOR_IPU("Keychron C3 Pro 8K", DetectQMKKeychronControllers, KEYCHRON_VID, KEYCHRON_C3_PRO_8K_JIS_PID, 1, KEYCHRON_QMK_USAGE_PAGE, KEYCHRON_QMK_USAGE);
REGISTER_HID_DETECTOR_IPU("Keychron J2 HE 8K", DetectQMKKeychronControllers, KEYCHRON_VID, KEYCHRON_J2_HE_8K_ANSI_PID, 1, KEYCHRON_QMK_USAGE_PAGE, KEYCHRON_QMK_USAGE);
REGISTER_HID_DETECTOR_IPU("Keychron K0 Max", DetectQMKKeychronControllers, KEYCHRON_VID, KEYCHRON_K0_MAX_PID, 1, KEYCHRON_QMK_USAGE_PAGE, KEYCHRON_QMK_USAGE);
REGISTER_HID_DETECTOR_IPU("Keychron K1 Max", DetectQMKKeychronControllers, KEYCHRON_VID, KEYCHRON_K1_MAX_ANSI_RGB_PID, 1, KEYCHRON_QMK_USAGE_PAGE, KEYCHRON_QMK_USAGE);
REGISTER_HID_DETECTOR_IPU("Keychron K1 Max", DetectQMKKeychronControllers, KEYCHRON_VID, KEYCHRON_K1_MAX_ISO_RGB_PID, 1, KEYCHRON_QMK_USAGE_PAGE, KEYCHRON_QMK_USAGE);