python 3, headless RaspPi, locale de_DE not possible for python-evdev

admin

Administrator
Staff member
After the main problem is solved <a href="https://stackoverflow.com/questions...rom-multiple-hid-inputs-raspberry-pi/47247208">try to read from multiple HID inputs</a> I open here a new question for the following (and different) problem:

I installed <a href="https://minibianpi.wordpress.com" rel="nofollow noreferrer">minibian</a> on a RaspPi. The entire system is running on
Code:
'de_DE'
, in details:

Code:
[email protected]:~# locale
LANG=de_DE.UTF-8
LANGUAGE=
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=

and

Code:
[email protected]:~# grep -v ^# /etc/locale.gen
de_DE.UTF-8 UTF-8

and also python
Code:
locale.getdefaultlocale()
says
Code:
'de_DE','utf-8'
.

There is no X running (because it's not installed):
Code:
ps -aux | grep X
says
Code:
1297 0.0 0.1 4212 1828 pts/0 S+ 10:13 0:00 grep X
and
Code:
systemctl get-default
says
Code:
multi-user.target
.

But there is the following problem: I have a German keyboard connected, which writes german as expected in console, but is recognized as english from evdev. I am using these scripts, <a href="https://khanhicetea.com/post/read_input_from_usb_keyboard_in_linux/" rel="nofollow noreferrer">read input from usb keyboard in linux</a> in combination with <a href="http://python-evdev.readthedocs.io/...ing-events-from-multiple-devices-using-select" rel="nofollow noreferrer">reading events from multiple devices</a> which works as expected, except the language. My
Code:
Y
keystroke is recognized as
Code:
KEY_Z
, my
Code:
Z
keystroke as
Code:
KEY_Y
, my
Code:
ß
as
Code:
KEY_MINUS
and so on. But everything, so far I can see, is set to
Code:
de_DE
.

This script (the evdev part only)

Code:
from evdev import InputDevice, categorize, ecodes
dev = InputDevice('/dev/input/event0')

print(dev)
#device /dev/input/event1, name "Dell Dell USB Keyboard", phys "usb-0000:00:12.1-2/input0"

for event in dev.read_loop():
    if event.type == ecodes.EV_KEY:
        print(categorize(event))

says

Code:
key event at 1510568613.966220, 44 (KEY_Z), down
key event at 1510568614.039341, 44 (KEY_Z), up
key event at 1510568614.926334, 21 (KEY_Y), down
key event at 1510568614.998331, 21 (KEY_Y), up
key event at 1510568615.799577, 12 (KEY_MINUS), down
key event at 1510568615.863569, 12 (KEY_MINUS), up

for
Code:
yzß
keystrokes.

What's wrong here ?