From 992b412be203a51f5f36b3593c1e733afcc4162d Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Wed, 24 Jul 2024 15:09:40 +0200 Subject: [PATCH] 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 --- repos/dde_linux/src/lib/lx_emul/shadow/drivers/input/evdev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/repos/dde_linux/src/lib/lx_emul/shadow/drivers/input/evdev.c b/repos/dde_linux/src/lib/lx_emul/shadow/drivers/input/evdev.c index 7cb11220ae..c31be08963 100644 --- a/repos/dde_linux/src/lib/lx_emul/shadow/drivers/input/evdev.c +++ b/repos/dde_linux/src/lib/lx_emul/shadow/drivers/input/evdev.c @@ -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 {