Linux – A single key on keyboard produces extra keypresses for each simultaneously pressed key

keyboardlinuxusb

I recently acquired MK-85 mechanical USB keyboard from QPAD. The keyboard works perfect on Windows. It works perfect in Syslinux. It works almost perfect on Linux. The only issue on Linux is that a single key is misbehaving (Gentoo (3.6.11), Arch Linux and Linux Mint (2.6.38) are all affected).

The keyboard is a 105-key German layout keyboard and the key in question is the one between Ä and ENTER. On US layout this corresponds to the key \, on German layout this corresponds to # and on Scandinavian layout it's '.

When this key is pressed with other keys, it produces an extra keypress for each other key that is simultaneously pressed. For example, under Scandinavian layout if I want to type the word "don't" really fast I end up with: don'''t'

The behaviour can be observed with the program showkeys:

kb mode was UNICODE
[ if you are trying this under X, it might not work
since the X server is also reading /dev/console ]

press any key (program terminates 10s after last keypress)...
keycode  28 release
keycode  32 press    // d pressed
keycode  24 press    // o pressed
keycode  49 press    // n pressed
keycode  32 release  // d released
keycode  43 press    // ' pressed
keycode  24 release  // o released
keycode  43 release  // ' released
keycode  43 press    // ' pressed, extra ' produced
keycode  49 release  // n released
keycode  43 release  // ' released
keycode  43 press    // ' pressed, extra ' produced
keycode  20 press    // t pressed
keycode  43 release  // ' released
keycode  43 press    // ' pressed, extra ' produced
keycode  20 release  // t released
keycode  43 release  // ' released
keycode  43 press    // ' pressed, extra ' produced
keycode  43 release  // ' released (REAL)

It only happens with this single key, regardless of keyboard layout. Another way it manifests itself is if I press and hold a key, it repeats, and I press and hold another key which should also start repeating:

aaaaaaaaaakkkkkkkkkkkkk (works as intended)
¨¨¨¨¨¨¨¨¨¨fffffffffffff (works as intended)
''''''''''a'''''''''''' (a is not repeated, instead ' continues)

On Windows this issue does not exist:

OnKeyDown, Key code=68, Control keys=, Key name d
OnKeyPress d
OnKeyDown, Key code=79, Control keys=, Key name o
OnKeyPress o
OnKeyDown, Key code=78, Control keys=, Key name n
OnKeyPress n
OnKeyup, Key code=68, Control keys=, Key name d
OnKeyDown, Key code=191, Control keys=, Key name ........OEM specific
OnKeyPress '
OnKeyup, Key code=79, Control keys=, Key name o
OnKeyup, Key code=78, Control keys=, Key name n
OnKeyDown, Key code=84, Control keys=, Key name t
OnKeyPress t
OnKeyup, Key code=191, Control keys=, Key name ........OEM specific
OnKeyup, Key code=84, Control keys=, Key name t

What do you think SE? Hardware issue? It works fine in Syslinux which makes me feel like there'''s' something wrong on Linux side. Any pointers, ideas or better ways to debug? If getting this to work right requires patching the kernel I'm up for it.

Best Answer

I have tried to make a proper patch for this bug. It is a problem in the kernel rather than with the keyboard, although it could be argued that the keyboard behave in a strange way. Anyway, the patch is submitted to the linux-input list for review but there are no comments on it yet.

This should fix the problem mentioned here with the QPAD MK-85, but the same problem exists with Corsair K70, Gigabyte Osmium and other similar keyboards. If you have a keyboard that has the bug it would be great it you can test the patch. If you test it let me know if it works and also what keyboard you have, it is also important what language version you are using, US and non-US keyboards will behave differently. Note that the backslash key on US keyboards will have other labels on other versions of the keyboard.

Here is the mail from linux-input with the patch:

http://article.gmane.org/gmane.linux.kernel.input/37583

Related Question