Today i fixed a keyboard issue for PICO-8 running on a rpi3 B + raspbian(2016-05-27).
I use a German keyboard and the "<>" keys weren't displayed neither in console nor in code editor.
This occured with the static linked pico8 binary. ( pico8_dyn seems to work with the sdl version installed here, but runs to slow to be usable in my setup.)
As far as i understand it, it has to do with the keyboard handling of SDL. SDL seems to drop unknown keycodes.
I could observe an error message like:
INFO: The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL mailing list <[email protected]> EVDEV KeyCode 86 |
Creating a custom xmodmap file did not work. My custom keyboard mappings weren't recognised. So i tried to handle it a level closer to the keyboard and created a custom xkb mapping.
I copied the current used layout
cp /usr/share/X11/xkb/symbols/de /usr/share/X11/xkb/symbols/de_pi |
Modified de_pi so that less and greater were printed by pressing AltGr+x and AltGr+v:
... key <AB02> { [ x, X, less, U2039 ] }; key <AB04> { [ v, V, greater, singlelowquotemark ] }; ... |
Registered the new layout in /usr/share/X11/xkb/rules/xfree86.lst
... de German de_pi German (PICO-8) gr Greek ... |
Enabled it in /etc/default/keyboard
XKBMODEL="pc105" XKBLAYOUT="de_pi" XKBVARIANT="" XKBOPTIONS="" |
And after restarting the raspberry pi. < and > can be used in PICO-8.
Put this here. May be someone find it usefull
Hm, with the current release (0.1.10) my solution seems to be broken, as there is now a hard coded US layout.
Does anyone know a way to change this layout?
Otherwise i think i have to write a complete own raspi/pico-8 xkb mapping for my german keyboards.
"The mapped keyboard events for text input (SDL_TEXTINPUT) also seems to be broken for some raspis (so far observed on 2nd generation units), so 0.1.10 now detects if this is happening and uses a hard-coded US layout based on keydown events instead."
For me it might be enough to suppress this error detection and use the "broken" text input solution. My be there is an option or flag to avoid this fallback?
I have the same problem on raspberry 2 and 3 regarding french keyboard ( which works well in the bash console ) .
I was thinking of patching my sdl "dirtily".
As far as I can remember ( I build sdl2.0.3 projects on raspi 1b , 2 and 3 ), the keymap has always appeared as us in my sdl apps , regardless of my raspi settings ( various raspbians over the years ) .
Any solutions found to this issue? I'm still not able to use a german keyboard on a raspberry pi.
Okay so my current approach is to rewire the scancode to keycode mapping with udev. This seems to be possible.
The downside of this solution is, that any other normal keyboard mapping or locale setting on the next layers set with xkb, localectl or what ever will be broken.
But I was able to remap keys of a USB keyboard.
(Done on a 4.9.59-1-ARCH ArchLinux)
My /etc/udev/hwdb.d/90-custom-keyboard.hwdb looks like this
evdev:input:b0003v04D9pA008* KEYBOARD_KEY_7001d=y KEYBOARD_KEY_7001c=z |
This swapped z with y to take the first step from US qwerty to DE qwertz layout in pico-8
If a DE keyboard layout is set in this situation, then in every other application the key are swapped a second time.
The cryptic evdev address was derived from the output of
# evtest /dev/input/event0 | head ... ... Input device ID: bus 0x3 vendor 0x4d9 product 0xa088 version 0x111 |
So "vendor 0x4d9" becomes "v04D9". Small letter v + capitalized 4-digit hexcode.
To apply this settings, i did:
udevadm hwdb --update udevadm trigger --sysname-match="event*" |
Todo:
- Map more keys to get a full hardwired non-us layout in pico-8
- Write a pico-8 start script which apllies the mapping and revokes it when pico-8 is quit.
Sources:
Hm, okay this wont work out, because on this level you don't have control over meta key mapping. I'm going with keyboardstickers. :P
[Please log in to post a comment]