[PATCH v5 4/4] platform: lenovo: wmi-fn-keys: ignore all Legion keyboard backlight events
From: David Cemin
Date: Wed Dec 02 2026 - 19:03:57 EST
The keymap ignores 0x19, 0x1a and 0x21, which the Legion Pro 7 16IAX10H
was seen to emit for Fn+Down, Fn+Up and Fn+Space. Marco reports that on
the Legion Pro 7 16AFR10H these events do not name a key, they encode
the state that was reached: Fn+Up and Fn+Down report the new brightness
level (0x18 off, 0x19 low, 0x1a medium, 0x26 high) and Fn+Space reports
the new lighting preset (0x20 to 0x25). The three codes ignored today
are "low", "medium" and "preset 2", so the other seven still reach
userspace as KEY_UNKNOWN.
The keyboard controller handles these keys itself and reports the
brightness on its own HID interface, so none of the events carries an
action for the OS. Ignore all ten.
I have no Legion to test this on: the codes are taken from the report
linked below.
Suggested-by: Marco Giunta <marco_giunta@xxxxxxxxxx>
Link: https://lore.kernel.org/r/BYAPR19MB229323713AAFB68EC5D8443EFC402@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Signed-off-by: David Cemin <dcemin@xxxxxxxxxx>
---
drivers/platform/lenovo/wmi-fn-keys.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/lenovo/wmi-fn-keys.c b/drivers/platform/lenovo/wmi-fn-keys.c
index dc5749be7d83..3710b2232fe3 100644
--- a/drivers/platform/lenovo/wmi-fn-keys.c
+++ b/drivers/platform/lenovo/wmi-fn-keys.c
@@ -71,10 +71,24 @@ static const struct key_entry lwmi_fn_keys_keymap[] = {
{ KE_IGNORE, 0x02 | LWMI_FN_KEY },
/* Esc (handled by the firmware) */
{ KE_IGNORE, 0x03 | LWMI_FN_KEY },
- /* Keyboard backlight down, up and effect (handled by the keyboard) */
+ /*
+ * Legion keyboard backlight level after Fn+Up/Down, handled by the
+ * keyboard: 0x18 off, 0x19 low, 0x1a medium, 0x26 high
+ */
+ { KE_IGNORE, 0x18 | LWMI_FN_KEY },
{ KE_IGNORE, 0x19 | LWMI_FN_KEY },
{ KE_IGNORE, 0x1a | LWMI_FN_KEY },
+ { KE_IGNORE, 0x26 | LWMI_FN_KEY },
+ /*
+ * Legion keyboard lighting preset after Fn+Space, handled by the
+ * keyboard: 0x20 to 0x25 are presets 1 to 6
+ */
+ { KE_IGNORE, 0x20 | LWMI_FN_KEY },
{ KE_IGNORE, 0x21 | LWMI_FN_KEY },
+ { KE_IGNORE, 0x22 | LWMI_FN_KEY },
+ { KE_IGNORE, 0x23 | LWMI_FN_KEY },
+ { KE_IGNORE, 0x24 | LWMI_FN_KEY },
+ { KE_IGNORE, 0x25 | LWMI_FN_KEY },
/*
* Keyboard backlight level after Fn+Space, handled by the firmware:
* 0x40 off, 0x41 low, 0x42 high
--
2.56.1