Scan Codes for a Custom Keyboard
Chad Skeeters
cskeeters at nciinc.com
Fri May 10 12:34:34 PDT 2013
James,
Thanks for the reply. I've downloaded that tool and it is reporting
the scan codes as I press the keys. With this information and other
things I have read since my original post, I've got everything I need
to get all of the keys working. Thanks!
I want to document what else I've learned in case anyone else stumbles
across this email chain.
When I ran dmesg, I saw entries about the unhanded scan codes:
Unknown key released (translated set 2, code ?? on ??). atkbd.c: Use
'setkeycodes ?? <keycode>' to make it known.
That is documented here:
http://www.jveweb.net/en/archives/2011/01/configure-unrecognized-keys-in-linux.html
That told me that the scan code WAS being picked up by the os. It
also clued me into the need to run setkeycodes so that my scan codes
will get translated into keycodes.
I found out that showkey -s doesn't actually show scan codes in all
cases due to a kernel change in 2.6. It really was better to use
evtest!
"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."
"The raw scan codes are available only on AT and PS/2 keyboards, and
even then they are disabled unless the atkbd.softraw=0 kernel
parameter is used."
A lot of good information about how scan codes get translated and
re-translated on linux can be found here:
https://www.berrange.com/posts/2010/07/04/a-summary-of-scan-code-key-codes-sets-used-in-the-pc-virtualization-stack/
This documents how evdev adds 8 to the key code before it passes it
along. Before I found that I was very confused why
usr/share/X11/xkb/evdev had key codes different than the linux key
codes /usr/include/linux/input.h.
Chad Skeeters
NCI Information Systems, Inc.
210-582-3275
On Thu, May 9, 2013 at 3:17 PM, James Cloos <cloos at jhcloos.com> wrote:
>>>>>> "CS" == Chad Skeeters <cskeeters at nciinc.com> writes:
>
> CS> The scan codes that I need to work are:
>
> First make sure that the kernel understands them.
>
> Try running evtest¹ to see whether the kernel reports anything.
>
> If it does not, you'll need to get that working first.
> linux-input at vger.kernel.org would be a good place to ask about that.
>
> 1] You can get a tar of evtest from:
> http://cgit.freedesktop.org/evtest/snapshot/evtest-evtest-1.30.tar.gz
> or clone the repo with either of:
> git clone git://git.freedesktop.org/git/evtest.git
> git clone http://git.freedesktop.org/evtest/
>
> -JimC
> --
> James Cloos <cloos at jhcloos.com> OpenPGP: 1024D/ED7DAEA6
> ################################################################################
> If you have received this message in error, please contact the sender
> immediately and be aware that the use, copying, or dissemination of
> this information is prohibited. This email transmission contains
> information from NCI Information Systems, Inc. that may be considered
> privileged or confidential and is intended solely for the named
> recipient.
> ################################################################################
More information about the xorg
mailing list