[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3f49d41e-649d-4a07-9a1a-301a2f52613c@redhat.com>
Date: Mon, 8 Apr 2024 15:13:05 +0200
From: Hans de Goede <hdegoede@...hat.com>
To: Mark Pearson <mpearson-lenovo@...ebb.ca>
Cc: ilpo.jarvinen@...ux.intel.com, hmh@....eng.br, dmitry.torokhov@...il.com,
ibm-acpi-devel@...ts.sourceforge.net, platform-driver-x86@...r.kernel.org,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
njoshi1@...ovo.com, vsankar@...ovo.com, peter.hutterer@...hat.com
Subject: Re: [PATCH 4/4] platform/x86: thinkpad_acpi: Support hotkey to
disable trackpoint doubletap
Hi,
On 3/24/24 10:08 PM, Mark Pearson wrote:
> The hotkey combination FN+G can be used to disable the trackpoint
> doubletap feature on Windows.
> Add matching functionality for Linux.
>
> Signed-off-by: Mark Pearson <mpearson-lenovo@...ebb.ca>
> Signed-off-by: Vishnu Sankar <vsankar@...ovo.com>
> ---
> drivers/platform/x86/thinkpad_acpi.c | 24 +++++++++++++++++-------
> 1 file changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
> index 854ce971bde2..21756aa3d28d 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -167,6 +167,7 @@ enum tpacpi_hkey_event_t {
> TP_HKEY_EV_VOL_MUTE = 0x1017, /* Mixer output mute */
> TP_HKEY_EV_PRIVACYGUARD_TOGGLE = 0x130f, /* Toggle priv.guard on/off */
> TP_HKEY_EV_AMT_TOGGLE = 0x131a, /* Toggle AMT on/off */
> + TP_HKEY_EV_DOUBLETAP_TOGGLE = 0x131c, /* Toggle trackpoint doubletap on/off */
> TP_HKEY_EV_PROFILE_TOGGLE = 0x131f, /* Toggle platform profile */
>
> /* Reasons for waking up from S3/S4 */
> @@ -354,6 +355,7 @@ static struct {
> u32 hotkey_poll_active:1;
> u32 has_adaptive_kbd:1;
> u32 kbd_lang:1;
> + u32 trackpoint_doubletap:1;
> struct quirk_entry *quirks;
> } tp_features;
>
> @@ -3598,6 +3600,9 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
>
> hotkey_poll_setup_safe(true);
>
> + /* Enable doubletap by default */
> + tp_features.trackpoint_doubletap = 1;
> +
> return 0;
> }
>
> @@ -3739,6 +3744,7 @@ static bool hotkey_notify_extended_hotkey(const u32 hkey)
> case TP_HKEY_EV_PRIVACYGUARD_TOGGLE:
> case TP_HKEY_EV_AMT_TOGGLE:
> case TP_HKEY_EV_PROFILE_TOGGLE:
> + case TP_HKEY_EV_DOUBLETAP_TOGGLE:
> tpacpi_driver_event(hkey);
> return true;
> }
> @@ -4092,13 +4098,15 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
> send_acpi_ev = true;
> ignore_acpi_ev = false;
> known_ev = true;
> - /* Send to user space */
> - mutex_lock(&tpacpi_inputdev_send_mutex);
> - input_report_key(tpacpi_inputdev, KEY_DOUBLECLICK, 1);
> - input_sync(tpacpi_inputdev);
> - input_report_key(tpacpi_inputdev, KEY_DOUBLECLICK, 0);
> - input_sync(tpacpi_inputdev);
> - mutex_unlock(&tpacpi_inputdev_send_mutex);
> + if (tp_features.trackpoint_doubletap) {
> + /* Send to user space */
> + mutex_lock(&tpacpi_inputdev_send_mutex);
> + input_report_key(tpacpi_inputdev, KEY_DOUBLECLICK, 1);
> + input_sync(tpacpi_inputdev);
> + input_report_key(tpacpi_inputdev, KEY_DOUBLECLICK, 0);
> + input_sync(tpacpi_inputdev);
> + mutex_unlock(&tpacpi_inputdev_send_mutex);
> + }
> break;
> }
> fallthrough; /* to default */
This chunk will need to change after incorporating my review comments into
patch 2/4. With that said this looks good to me:
Reviewed-by: Hans de Goede <hdegoede@...hat.com>
Regards,
Hans
> @@ -11228,6 +11236,8 @@ static void tpacpi_driver_event(const unsigned int hkey_event)
> /* Notify user space the profile changed */
> platform_profile_notify();
> }
> + if (hkey_event == TP_HKEY_EV_DOUBLETAP_TOGGLE)
> + tp_features.trackpoint_doubletap = !tp_features.trackpoint_doubletap;
> }
>
> static void hotkey_driver_event(const unsigned int scancode)
Powered by blists - more mailing lists