* Re: "showkey -s" prints incorrect scan codes
2026-09-16 2:23 "showkey -s" prints incorrect scan codes Vincent Lefevre
@ 2026-09-17 13:30 ` Alexey Gladkov
0 siblings, 0 replies; 2+ messages in thread
From: Alexey Gladkov @ 2026-09-17 13:30 UTC (permalink / raw)
To: Vincent Lefevre; +Cc: kbd
On Wed, Sep 16, 2026 at 04:23:30AM +0200, Vincent Lefevre wrote:
> Under Debian/unstable (package kbd 2.9.0-1), "showkey -s" prints
> completely incorrect scan codes, and doesn't even print anything
> for the Fn key (while evtest does).
>
> This is apparently a known bug:
> https://wiki.archlinux.org/title/Keyboard_input
>
> Except from this wiki, I couldn't find any mention of this bug,
> so this was rather surprising.
This is written directly in the man page:
In 2.6 kernels raw mode, or scancode mode, is not very raw at all.
Scan codes are first translated to key codes, and when scancodes are
desired, the key codes are translated back. Various transformations are
involved, and there is no guarantee at all that the final result
corresponds to what the keyboard hardware did send. So, if you want to
know the scan codes sent by various keys it is better to boot a 2.4
kernel. Since 2.6.9 there also is the boot option atkbd.softraw=0 that
tells the 2.6 kernel to return the actual scan codes.
So this is a problem that has been known for a very long time. By saying
that, I don't mean that it shouldn't be fixed.
showkey is a very old utility, and I have to admit I had completely
forgotten about a feature like getting scancodes. I think I could add
support for evdev to get the correct result.
I added the --device={DEV,all} option, which specifies which device to
use. If it is an evdev device, a new mechanism for retrieving scancodes
will be used. You can simply run:
./showkey --device=all --scancodes
Could you try it in the for-master branch ?
Does this behavior of the utility seem normal to you?
https://github.com/legionus/kbd/compare/master...refs/heads/for-master
--
Rgrds, legion
^ permalink raw reply [flat|nested] 2+ messages in thread