All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Gladkov <legion@kernel.org>
To: Vincent Lefevre <vincent@vinc17.net>
Cc: kbd@lists.linux.dev
Subject: Re: "showkey -s" prints incorrect scan codes
Date: Thu, 17 Sep 2026 15:30:27 +0200	[thread overview]
Message-ID: <aqvrc2xiHOmALe0W@example.org> (raw)
In-Reply-To: <20260916022330.GA731654@qaa.vinc17.org>

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


      reply	other threads:[~2026-09-17 13:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16  2:23 "showkey -s" prints incorrect scan codes Vincent Lefevre
2026-09-17 13:30 ` Alexey Gladkov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aqvrc2xiHOmALe0W@example.org \
    --to=legion@kernel.org \
    --cc=kbd@lists.linux.dev \
    --cc=vincent@vinc17.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.