daemon: Clear K100 dial bits

Unconditionally clear the controlwheel keybits for all devices, that
have a control wheel.
This commit is contained in:
Karl Fleischmann
2026-05-20 16:33:52 +02:00
parent cf856752dd
commit 8631b804fe
2 changed files with 22 additions and 14 deletions
+10 -5
View File
@@ -897,16 +897,22 @@ void process_input_urb(void* context, unsigned char* buffer, int urblen, ushort
// We need to split the bragi code because the size check needs to go first
if(kb->protocol == PROTO_BRAGI) {
#define BRAGI_MEDIA_MASK 0x60
// Always clear the control wheel key bits.
// This will enable the daemon to emulate keyup events in inputupdate_keys().
if (DEV_HAS_CTRLWHEEL(kb)) {
CLEAR_KEYBIT(targetkb->input.keys, 129);
CLEAR_KEYBIT(targetkb->input.keys, 130);
}
if(urblen == 64) {
if(buffer[1] == BRAGI_INPUT_HID) {
corsair_kbcopy(targetkb->input.keys, buffer + 2);
// Check if we need to apply an awful hack to get media keys working
handle_bragi_media_keys(targetkb);
} else if(buffer[1] == BRAGI_INPUT_DIAL) {
#define MEDIA_MASK 0x60
if(buffer[1] == BRAGI_INPUT_DIAL && buffer[2] == MEDIA_MASK) {
// This is a packet from the volume dial
} else if(buffer[1] == BRAGI_INPUT_DIAL && buffer[2] == BRAGI_MEDIA_MASK) {
// This is a packet from the control dial
// We need to handle it appropriately then clear the keys so we stop getting garbage
int32_t wheel;
memcpy(&wheel, buffer + 4, sizeof(int32_t));
@@ -917,7 +923,6 @@ void process_input_urb(void* context, unsigned char* buffer, int urblen, ushort
// Apply fresh key data: counter-clockwise rotation
SET_KEYBIT(targetkb->input.keys, 130);
}
}
} else {
ckb_err("Unimplemented bragi input packet %hhx\n", buffer[1]);
}
+3
View File
@@ -296,6 +296,9 @@ const char* product_str(ushort product);
// Devices that have volume wheels (or don't)
#define DEV_HAS_VOLWHEEL(kb) (!(IS_K65(kb) || IS_K63(kb) || (kb)->product == P_K57_U || IS_K55(kb) || IS_K60PRORGB(kb)))
// Devices that have a control wheel
#define DEV_HAS_CTRLWHEEL(kb) ((kb)->vendor == V_CORSAIR && (IS_K70CORERGB(kb) || (kb)->product == P_K100_MECHANICAL || (kb)->product == P_K100_OPTICAL || (kb)->product == P_K100_OPTICAL_VARIANT))
// Devices that use the NXP protocol and have the DPI stage RGB data in the DPI packet
#define NXP_RGB_IN_DPI_PKT(kb) ((kb)->vendor == V_CORSAIR && ((kb)->product == P_GLAIVE_PRO || IS_DARK_CORE_NXP(kb)))