diff options
author | Hans de Goede <hdegoede@redhat.com> | 2024-04-24 14:28:15 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2024-04-29 11:44:12 +0200 |
commit | d761684afda3a784b9e5e88281d4f52cc0cffa08 (patch) | |
tree | e2de07b95d2eba255f5e16d1e1b32095cc9e37e8 /drivers/platform/x86/thinkpad_acpi.c | |
parent | 32c284b7bc4357c755edf5d09ec932f40ebf9928 (diff) |
platform/x86: thinkpad_acpi: Use tpacpi_input_send_key() in adaptive kbd code
Use tpacpi_input_send_key() in adaptive_keyboard_hotkey_notify_hotkey()
instead of re-implementing it there.
Note this change will also result in a behavioral change, key presses on
the adaptive keyboard will now also send a EV_MSC event with the scancode,
just like all other hotkey presses already do. This is not a bug but
a feature.
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Link: https://lore.kernel.org/r/20240424122834.19801-6-hdegoede@redhat.com
Diffstat (limited to 'drivers/platform/x86/thinkpad_acpi.c')
-rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 45c68f10a5a9..c80238438a94 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -3670,7 +3670,6 @@ static bool adaptive_keyboard_hotkey_notify_hotkey(unsigned int scancode) { int current_mode = 0; int new_mode = 0; - int keycode; switch (scancode) { case DFR_CHANGE_ROW: @@ -3711,19 +3710,8 @@ static bool adaptive_keyboard_hotkey_notify_hotkey(unsigned int scancode) scancode); return false; } - keycode = hotkey_keycode_map[scancode - FIRST_ADAPTIVE_KEY + - TP_ACPI_HOTKEYSCAN_ADAPTIVE_START]; - if (keycode != KEY_RESERVED) { - mutex_lock(&tpacpi_inputdev_send_mutex); - - input_report_key(tpacpi_inputdev, keycode, 1); - input_sync(tpacpi_inputdev); - - input_report_key(tpacpi_inputdev, keycode, 0); - input_sync(tpacpi_inputdev); - - mutex_unlock(&tpacpi_inputdev_send_mutex); - } + tpacpi_input_send_key(scancode - FIRST_ADAPTIVE_KEY + + TP_ACPI_HOTKEYSCAN_ADAPTIVE_START); return true; } } |