welford wrote:Thank you Daverj.
Is there any documentation of the remapping process available online?
I haven't seen it. I assume it's buried in the kernel config files for keyboards.
When you first run the Pi, or run raspi-config, and choose to configure the keyboard the first step is to select the type of keyboard. The next step is to select the country/language map for the keyboard. My guess is that the first choice is choosing the hardware, which in turn is determining the scancodes for the physical buttons. The second choice is choosing the remapping of the keyboard to assign the keys to have the meaning of what is printed on the keys themselves. (ie: the same physical keyboard might be manufactured with different keys marked in different ways) By choosing the country/language for your keyboard you are determining which arrangement of those keys your keyboard has.
Personally if you are looking for keys that are hit by the user, I would ignore the EV_MSC/MSC_SCAN and just use the EV_KEY keycode values. Not only is it telling you what key the person typed (letter, number, arrows, etc...) but it is also telling you if they pressed it, released it, or if it is auto repeating. Those aren't conveyed by the scancode in the MSC_SCAN value.
If you used the MSC_SCAN scancodes you would be bypassing the keyboard mapping that the user selected when they configured their Pi and would not see the correct keys in many cases. The whole point of having that abstraction is so your program doesn't have to know about hundreds of types of keyboards and a thousand different keyboard country/language mappings. You just need to know that the person pressed the "#" key (or whatever key), no matter where it is on their specific keyboard.