lx_emul: silently drop KEY_FN in evdev

The Fn key on keyboards should never be reported as real scancode event,
as it is just a hardware switch that changes the reported scancodes of
other keys. The behavior of Linux hid-apple.c is wrong as it on one hand
reports different scancodes for the same hard key depending on the Fn
state but sends the Fn press and release events too. Thus from now on,
we just drop KEY_FN events for all drivers as otherwise, scancodes
generated generated by Fn+key combinations would never be single-key
events on upper layers, for example KEY_FN + KEY_F12 on the Matias Apple
keyboard clone in the fixed issue.

Fixes #5288
This commit is contained in:
Christian Helmuth 2024-07-24 15:09:40 +02:00
parent 110a24f650
commit 992b412be2

View File

@ -378,6 +378,10 @@ static bool record_key(struct evdev *evdev, struct input_value const *v)
if (v->type != EV_KEY)
return false;
/* silently drop KEY_FN as hardware switch */
if (v->code == KEY_FN)
return true;
if (is_tool_key(v->code)) {
evdev->tool = v->value ? v->code : 0;
} else {