Red Hat Bugzilla – Bug 211803
keycode from showkey unchanged after change by setkeycodes
Last modified: 2007-11-30 17:11:46 EST
Description of problem:
A change of keycode of special keys (scancode 0xe...) using
command "setkeycodes" does not take actual effect allthough reflected by
Version-Release number of selected component (if applicable):
Linux 2.6.18-1.2200.fc5 i686 athlon i386 GNU/Linux fully up2date
Steps to Reproduce:
1. ensure that X server is not running.
2. login as root
3. enter command "showkey -s"
4. press-release a special key on the keyboard
5. make note of reported scancode
5. enter command "showkey -k"
6. press-release the same key
7. make note of reported keycode
8. enter command "setkeycodes scancode keycode2"
where scancode is the same as the above reported by showkey for the key press
but keycode is a different value than that above reported by showkey.
9. verify change using command "getkeycodes"
10. again enter command "showkey -k"
11. press-release the same key
12. the keycode reported is unchanged and did not change to the value set by
the command "setkeycodes"
I expected the change of keycode to take effect because it used to (maybe a
year ago when I last used command "setkeycodes").
I just got a USB keyboard. I already had a PS/2 keyboard. Both have a top row
of special keys that both include for example a WWW key that's supposed to
launch an internet browser. But only one of the WWW keys actually does; the
other does nothing. The keycodes of the WWW keys are different so I'm trying to
(re-)set the keycode of the non working WWW key to the same keycode as that of
the other WWW key that does work.
This is a problem related to the new input facilities in the 2.6 kernel. In the
2.6 kernel scan codes are dropped very early and only key codes make their way
through the driver stack. If an application (like showkey -s) set its tty to raw
mode the kernel emulates scan codes using a fixed table which assigns each key
code a scan code.
I don't see a simple way of fixing the above problem, but we should at least
update the man pages of showkey and setkeycodes to reflex that kernel changes.
In addition it should be mentioned that setkeycodes does not work with USB
Are you performing the "steps to reproduce" on the PS/2 keyboard or the USB
setkeycodes doesn't affect USB keyboards at all, but changing the PS/2 keyboard
mapping worked fine for me.
I did not know nor expect that the type of input device would matter and I
don't remember clearly which keyboard I used - so I just retested and now
realize as the comments say that the issue is with the USB keyboard only.
I have 2 keyboards - a PS/2 Adesso MCK-91 (notebook type keyboard) and a USB
Belkin MediaPilot (wireless). The PS/2 is connected via a Netgear KVM. The USB
is directly connected. Both are connected simultaneously.
Both keyboards have a WWW button that I used for the test. Keycodes 130 and
131 were not used according to getkeycodes so I used them for the test. Test
condition otherwise is fc6 vanilla fully up2date.
Here's my results (with time increasing downwards)
PS/2 (MCK-91) USB (MediaPilot)
showkey -s 0xe0 0x24 0xe0 0xa4 0xe0 0x02 0xe0 0x82
showkey -k 166 172
getkeycodes 166 (value of e024) 0 (value of e002)
setkeycodes e024 130 e002 131
showkey -s 0xe0 0x06 0xe0 0x86 unchanged
showkey -k 130 unchanged
getkeycodes 130 (value of e024) 131 (value of e002)
getkeycodes 0 (value of e006)
My conclusion is
Everything works - except that a change of keycode changes the scancode?
Nothing works - except that a change of keycode is correctly picked up by
In my above comment - the "Netgear KVM" is a "PS/2 Netgear KVM".
Thanks, this confirms that everything is working "as designed".
I have expanded the documentation in the setkeycodes and showkey man pages in