I have a vintage IBM 122 key model M keyboard that I am adapting for use on a modern computer. I am using a Teensy 2.0 to do the encoding and to handle the USB side of things. I borrowed the firmware from the Humble Hacker keyboard project (https://github.com/humblehacker/keyboard) and I added the extra keys in the build config. So far, so good.
All of the "regular" keys work, but the kernel appears to be dropping the extra keys (F13–F24, etc.).
Running /lib/udev/keymap -i input/event0
shows the scan codes of all the normal keys, but nothing for the extra keys.
Running wireshark
to packet capture the USB port shows that the keyboard IS sending the scan codes, but it looks like the kernel is just dropping them on principle.
I feel like this is something in the kernel drivers that is simply not delivering scan codes that it does not expect.
I would think that there would be some sort of "master" key map in some .h
file in the kernel source somewhere, but so far, I have not been successful in my efforts to find it.
It is worth stressing that I am not asking about mapping the extra keys in X, like so many others before me. This is a low level, apparently kernel related, problem. Assume for the moment that I will not be using X at all. What I need is for the scan codes to show up when I run /lib/udev/keymap -i
, I can do the rest from there.
Best Answer
The kernel sees the weird scan codes and drops them. I would try to get those scan codes values and then update the hardware database index. So in short the plan is this:
get the codes from dmesg output - dmesg should output something like this when the unknown keycode is pressed:
a0
being the code value.create custom keycode mapping file. The examples and help are in the default file
(
/usr/lib/udev/hwdb.d/60-keyboard.hwdb
for Arch, it may be different in other distributions).update and trigger the hardware database by running the commands:
where
eventXX
corresponds to your keyboard (you can get it by runningevtest
). You may also reboot instead of triggering.Look in Arch wiki and the default keycode mapping file for the more detailed description (or in your distribution documentation if it's not Arch).
This is the reliable and simple method, makes mapping on the kernel level so works whatever display server, DE etc is.