29/3/2015, 10:55

Func KB-460 and Linux

This will be one of those posts that I wish I would have been able to find myself when I encountered the problems I did.

After having been forced to listen to the hype about mechanical keyboards for way too long, I recently got myself a mechanical Func KB-460, featuring some deliciously noisy Cherry MX Blues and a red back-light that you can switch off if you're worried about getting the attention it might attract. Overall, I'm satisfied with the keyboard; some parts of it seem a little flimsy but at the moment, it is in the lower end of the mechanical keyboard price spectrum, so that is to be expected.



The problem


While using the keyboard, I quickly noticed a peculiar key duplication problem: whenever I would press a given key and the '-key in quick succession, the '-key would become duplicated several times; I'm would become I'm'', and you're would become you'r''e. You can imagine how annoying this would be when producing code. Meanwhile, the keyboard appears to not run into the issue on Linux.

Func is well aware of the problem, and while they do not provide Linux support, they guided me to this kernel bug which explains in detail what is going on, and how it affects not only the Func keyboard but apparently several keyboards with n-key rollover and various keyboard layouts. Roughly, the '-key registers as two different keys at the same time, which causes buggy behaviour when key strokes are performed quickly.



The fix


As is evident from the kernel.org thread a kernel patch exists and will likely be rolled out soon. Until then, there is a simply fix for it which requires no kernel patching at all. It has been tested on two separate Debian installations and probably works on other distros as well; it's similar to the hwdb solution provided by a Fedora user on kernel.org. This one uses keymap instead.

In essence, we will kill one of the two keys associated to the '-key so that only one of them registers. First, create a file /lib/udev/keymaps/func containing a single line


0x70031 reserved

corresponding to the scancode of the key. Next, to find the relevant input correponding to the keyboard, run cat /proc/bus/input/devices. You will see a block like



I: Bus=0003 Vendor=195d Product=2030 Version=0111
N: Name="Gaming keyboard"
P: Phys=usb-0000:00:12.2-3.2/input2
S: Sysfs=/devices/pci0000:00/0000:00:12.2/usb1/1-3/1-3.2/1-3.2:1.2/input/input7
U: Uniq=
H: Handlers=sysrq kbd event7
B: PROP=0
B: EV=100013
B: KEY=7f80000000000000 e0b0ffdf01cfffff fffffffffffffffe
B: MSC=10

Notice that the keyboard will list as several devices; simply taking the last one seems to always do the trick. Now, run the command /lib/udev/keymap /dev/input/event7 /lib/udev/keymaps/func and you should be good to go. Here, the "event7" comes from the output above.

Now you could simply include this single line in /etc/rc.local to have the code run on launch but be aware that the input numbers seem to change somewhat arbitrarily in my experience.


Tags: tech linux

Comments


No comments yet.


Add a comment

To avoid too much spam, you'll have to log in to add a comment. You can do so below, or you can create a user, if you don't already have one. You can use your photo login here as well.


E-mail address:
Password:  Forgot your password?
Captcha:

[ Different Image ]
CAPTCHA Image