[systemd-devel] Raw/translated keycode clashes in hwdb.d/60-keyboard.hwdb
Lennart Poettering
lennart at poettering.net
Mon Dec 21 15:14:11 UTC 2020
On Do, 03.12.20 04:22, Ardavast Dayleryan (ardavast at noiseoverip.com) wrote:
> 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?
Sure, please file a PR with a patch on github, or at least an issue.
I wonder if we can find a better match though than the name string,
i.e. what is key is that one keyboard is connected to the AT keyboard
controller, and yours is connected to a serial port, right? So the
udev rules should be fixed to match against the former only.
Anyway, please file a PR/issue on github about this, and continue the
discussion there.
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list