Skip to content

Commit 83088d8

Browse files
Fix erratic caps lock key
For some weird reason, the CAPS Lock key on the HID keyboard doesn't work properly. You can reproduce this bug by tapping the key rapidly. The underlying problem seems to be related with setting the keyboard LED state. If a report of setLED is processing, the system ignores all the subsequent reports. So, we induce an IOSleep of 80ms helping system to properly set LED state and fix the erratic CAPS Lock key behavior in the process. This fix should not hurt systems without a keyboard caps lock LED. However, if such is the case this fix should be re-implemented in a better way (custom implementaion of `SetLED` and `parseLEDElement`) Signed-off-by: black.dragon74 <[email protected]>
1 parent 33aa2b7 commit 83088d8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ROG-HID-Driver/ROG_HID_Driver.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ kern_return_t ROG_HID_Driver::dispatchKeyboardEvent(uint64_t timeStamp, uint32_t
233233
}
234234
}
235235

236+
// Fix erratic caps lock key
237+
if (usage == kHIDUsage_KeyboardCapsLock)
238+
IOSleep(80);
239+
236240
DBGLOG("Dispatch Event - usage: 0x%x, page: 0x%x, val: 0x%x", usage, usagePage, value);
237241
return super::dispatchKeyboardEvent(timeStamp, usagePage, usage, value, options, repeat);
238242
}

0 commit comments

Comments
 (0)