Skip to content

Commit 8f02154

Browse files
committed
platform/x86: thinkpad_acpi: Do not send ACPI netlink events for unknown hotkeys
Do not send ACPI netlink events for unknown hotkeys, to avoid userspace starting to rely on them. Instead these should be added to the keymap to send evdev events. This should not cause a behavior change for existing laptop models since all currently known 0x1xxx events have a mapping. In hindsight the ACPI netlink events should have been suppressed for the adaptive keyboard and extended hotkeys events too. But the kernel has been sending ACPI netlink events for those for a long time now, so we cannot just stop sending them without potentially causing issues for existing users who may depend on these. Tested-by: Mark Pearson <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Mark Pearson <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 56b3667 commit 8f02154

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

drivers/platform/x86/thinkpad_acpi.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2250,7 +2250,7 @@ static void tpacpi_input_send_tabletsw(void)
22502250
}
22512251
}
22522252

2253-
static bool tpacpi_input_send_key(const u32 hkey)
2253+
static bool tpacpi_input_send_key(const u32 hkey, bool *send_acpi_ev)
22542254
{
22552255
unsigned int keycode, scancode;
22562256

@@ -2271,6 +2271,14 @@ static bool tpacpi_input_send_key(const u32 hkey)
22712271
scancode = hkey - TP_HKEY_EV_EXTENDED_KEY_START +
22722272
TP_ACPI_HOTKEYSCAN_EXTENDED_START;
22732273
} else {
2274+
/*
2275+
* Do not send ACPI netlink events for unknown hotkeys, to
2276+
* avoid userspace starting to rely on them. Instead these
2277+
* should be added to the keymap to send evdev events.
2278+
*/
2279+
if (send_acpi_ev)
2280+
*send_acpi_ev = false;
2281+
22742282
return false;
22752283
}
22762284

@@ -2298,7 +2306,7 @@ static struct tp_acpi_drv_struct ibm_hotkey_acpidriver;
22982306
/* Do NOT call without validating scancode first */
22992307
static void tpacpi_hotkey_send_key(unsigned int scancode)
23002308
{
2301-
tpacpi_input_send_key(TP_HKEY_EV_ORIG_KEY_START + scancode);
2309+
tpacpi_input_send_key(TP_HKEY_EV_ORIG_KEY_START + scancode, NULL);
23022310
}
23032311

23042312
static void hotkey_read_nvram(struct tp_nvram_state *n, const u32 m)
@@ -3734,7 +3742,7 @@ static bool hotkey_notify_hotkey(const u32 hkey, bool *send_acpi_ev)
37343742
return true;
37353743
}
37363744

3737-
return tpacpi_input_send_key(hkey);
3745+
return tpacpi_input_send_key(hkey, send_acpi_ev);
37383746
}
37393747

37403748
/* 0x2000-0x2FFF: Wakeup reason */

0 commit comments

Comments
 (0)