[systemd-devel] Raw/translated keycode clashes in hwdb.d/60-keyboard.hwdb

Ardavast Dayleryan ardavast at noiseoverip.com
Thu Dec 3 02:22:11 UTC 2020


Hello,

I'm trying to emit keypresses from an embedded device connected over a
serial port, I attach it as an "AT Raw Set 2 keyboard" with inputattach
like this: sudo inputattach --baud 9600 --ps2serkbd /dev/ttyACM0

It usually works, but I noticed that on some laptops, some of the
scancodes do not work, for example on an IdeaPad Y580 the scancode for
KEY_DOWN does not work.
The scancode for KEY_DOWN on a raw set 2 keyboard is 0xe0 0x72, which
is encoded as 0xf2.
The scancode for KEY_DOWN on a translated set 2 keyboard is 0xd0, and
0xf2 is KEY_RESERVED.
I traced the problem to the following lines in hwdb.d/60-keyboard.hwdb:
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn*IdeaPad*:*
[...]
KEYBOARD_KEY_f1=camera
KEYBOARD_KEY_f2=f21
KEYBOARD_KEY_f3=f21

It seems that these lines are applied for both the raw and the
translated keyboards, and this works fine for the translated keyboard,
but it clashes with the scancode for KEY_DOWN on the raw keyboard and
I can't emit KEY_DOWN from it.

I was able to fix this by adding the following near the top of
rules.d/60-evdev.rules:
ATTRS{name}=="AT Raw Set 2 keyboard", GOTO="evdev_end"

But I'm a total noob when it comes to systemd/udev , so I wanted to ask:
1. Is this approach OK, or is it prone to break other stuff?
2. Would you consider including a fix for this issue in a future version?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20201203/845d74ca/attachment.htm>


More information about the systemd-devel mailing list