Apple's MacBook Pro has a slight delay on the caps lock key.
That is, the caps lock key has to be held down slightly longer
than normal to register the key press required to engage the caps lock.This is super annoying. Does anyone know how to stop it from happening?
(Above copied over from stackoverflow as it was closed there as "off topic".)
To elaborate further:
Apple deems this a feature, and their knowledge base article does not disclose how to disable this delay.
However, I have reason to believe it is possible to do so.
Notably, I have found that, at least in my experience, if you remap the caps-lock key on Mac OS X (in System Preferences .. Keyboard .. Modifier Keys), and e.g. map it to Control, then the delay goes away while I am logged into Mac OS X.
My problem is that the delay remains when I boot into Ubuntu Linux, and in that context, even when I remap the Caps Lock key to Control, the delay is still present.
So, the question is: How is Apple disabling the delay, and more importantly, how can one replicate that act in the context of a Linux installation atop the laptop?
Update: There is a thread on superuser that may provide workarounds. I have not yet tried the suggestions there (namely: (1) toggling CapsLock-NoAction off/on, and (2) a firmware upgrade). I cannot tell from the context of that thread whether the workarounds have been tested on an Ubuntu installation.
Best Answer
I've figured out how to do this. In short, you must send a "Feature Report" consisting of the bytes
0x9, 0x0, 0x0, 0x0
to the appropriate hidraw device as root.You can find the right hidraw device with this command:
The code to send the magic control packet is below. Compiles with gcc, takes the hidraw device as parameter. So the entire flow is:
disable-capslock-delay.c
gcc -o disable-capslock-delay disable-capslock-delay.c
HIDDEVICE=$(dmesg | grep Apple | grep Keyboard | grep input0 | tail -1 | sed -e 's/.*hidraw\([[:digit:]]\+\).*/\/dev\/hidraw\1/')
sudo ./disable-capslock-delay $HIDDEVICE
Steps 3 and 4 have to be done every time you reboot (or unplug and re-plug the keyboard); you can put them into
/etc/rc.local
(or your distro's equivalent) to execute them at boot (you don't needsudo
in that case; and you might want to move the compiled binary into/usr/local/sbin/
or something).I've put in some safety checks for vendor ID, device ID, and report descriptor length. You may have to change the latter two if your model differs from mine.