megi's PinePhone Development Log RSS

Surgenons in Gaza Surgeons in Gaza

2022–04–12: Pinephone keyboard keymaps

I've merged latest keyboard driver from Samuel to my 5.17 and 5.18 kernel branches. That driver has function keys F1-F10 mapped to Fn+1-Fn+0. There's no way to type alternate symbols printed on those keys, without loading a keymap into a kernel.

For use with Linux kernel virtual console, you can load the following keymap via loadkeys -d ppkb.map:

strings as usual
compose as usual for "iso-8859-1"
keymaps 0-63

plain keycode 125 = ShiftR
ShiftR keycode 125 = ShiftR
ShiftR keycode 0x02 = bar
ShiftR keycode 0x03 = backslash
ShiftR keycode 0x06 = asciitilde
ShiftR keycode 0x07 = grave
ShiftR keycode 0x08 = minus
ShiftR keycode 0x09 = equal
ShiftR keycode 0x0a = underscore
ShiftR keycode 0x0b = plus

Afterwards you'll be able to type Pine+1 to type |, Pine+2 to type \, and so on. Of course you are not limited to this simple keymap, you can read man keymaps, and implement any kind of key mapping you want. You can override arrow keys to make them active by default, you can make use of AltG or Pine key for more things, etc.

You can create similar keymaps for XKB, for use with Xorg server or wayland compositors.

You should not be modifying keymaps inside the kernel or device tree.