Bug 211803 - keycode from showkey unchanged after change by setkeycodes
keycode from showkey unchanged after change by setkeycodes
Product: Fedora
Classification: Fedora
Component: kbd (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Miloslav Trmač
Depends On:
  Show dependency treegraph
Reported: 2006-10-23 00:28 EDT by Claus Olesen
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version: 1.12-20
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-12-07 12:34:12 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Claus Olesen 2006-10-23 00:28:22 EDT
Description of problem:
A change of keycode of special keys (scancode 0xe...) using 
command "setkeycodes" does not take actual effect allthough reflected by 
command "getkeycodes". 

Version-Release number of selected component (if applicable):
Linux 2.6.18-1.2200.fc5 i686 athlon i386 GNU/Linux fully up2date

How reproducible:

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

Actual results:
12. the keycode reported is unchanged and did not change to the value set by 
the command "setkeycodes"

Expected results:
I expected the change of keycode to take effect because it used to (maybe a 
year ago when I last used command "setkeycodes").

Additional info:
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.
Comment 1 Florian Festi 2006-11-14 06:11:12 EST
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
Comment 2 Miloslav Trmač 2006-11-28 07:02:43 EST
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.
Comment 3 Claus Olesen 2006-11-29 04:40:53 EST
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

PS/2 (MCK-91):
Everything works - except that a change of keycode changes the scancode?

USB (MediaPilot):
Nothing works - except that a change of keycode is correctly picked up by 
Comment 4 Claus Olesen 2006-11-29 04:50:58 EST
In my above comment - the "Netgear KVM" is a "PS/2 Netgear KVM".
Comment 5 Miloslav Trmač 2006-12-07 12:34:12 EST
Thanks, this confirms that everything is working "as designed".

I have expanded the documentation in the setkeycodes and showkey man pages in
rawhide kbd-1.12-20.

Note You need to log in before you can comment on or make changes to this bug.