Fixing keyboard chatter in Linux

Ave Milia avemilia at protonmail.com
Sat Oct 3 18:15:08 EDT 2020


Hello,

I have a faulty key switch on the keyboard that apparently sends multiple signals upon a single press. And apparently this is called keyboard chatter.

I was not able to find any information on how to fix this via software, nor was I able to find any Linux software that does this. The only information I was able to find was to use commands such as `xset r rate` for Xorg key repeat rate and `kbdrate` for Linux console repeat rate. However, setting e.g. `xset r rate 600 1` (delay before bulk emitting keystrokes: 600 ms, emit keystrokes with speed: 1 per second) did not fix the problem. Logically, it would seem that it targets keys that are already pressed down, based on which it can be reasoned that the computer registers a very fast sequence of key_down key_up events multiple times.

So a naive solution would be to set some time, e.g. 50ms, and then check if the difference (key_up - key_down) is < 50, and if it is, discard the keypress. Please correct me if I'm wrong.

Since no such software exists (or if it does, please share it), I would like to ask for your advice on how to implement this. I more or less know C, but I have no idea where to start on this problem:
* what do I need to know about Linux kernel to solve this?
* at which point of Linux input logic can I put this filter?
* does the filter have to be in kernel mode or it can be in user mode (I'd prefer not to work in kernel mode)?
* do I need to write a special input driver to implement this filter (the keyboard is a USB keyboard controlled by usbhid)?

So, I just need some basic directions and where to start.

Thanks in advance.



More information about the Kernelnewbies mailing list