}
}
-static bool tpacpi_input_send_key(const u32 hkey)
+static bool tpacpi_input_send_key(const u32 hkey, bool *send_acpi_ev)
{
unsigned int keycode, scancode;
scancode = hkey - TP_HKEY_EV_EXTENDED_KEY_START +
TP_ACPI_HOTKEYSCAN_EXTENDED_START;
} else {
+ /*
+ * 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.
+ */
+ if (send_acpi_ev)
+ *send_acpi_ev = false;
+
return false;
}
/* Do NOT call without validating scancode first */
static void tpacpi_hotkey_send_key(unsigned int scancode)
{
- tpacpi_input_send_key(TP_HKEY_EV_ORIG_KEY_START + scancode);
+ tpacpi_input_send_key(TP_HKEY_EV_ORIG_KEY_START + scancode, NULL);
}
static void hotkey_read_nvram(struct tp_nvram_state *n, const u32 m)
return true;
}
- return tpacpi_input_send_key(hkey);
+ return tpacpi_input_send_key(hkey, send_acpi_ev);
}
/* 0x2000-0x2FFF: Wakeup reason */