From: Mark Pearson <mpearson-lenovo@squebb.ca>
To: mpearson-lenovo@squebb.ca
Cc: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com,
hmh@hmh.eng.br, ibm-acpi-devel@lists.sourceforge.net,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, njoshi1@lenovo.com,
vsankar@lenovo.com, peter.hutterer@redhat.com,
Vishnu Sankar <vishnuocv@gmail.com>
Subject: [PATCH v2 4/4] platform/x86: thinkpad_acpi: Support hotkey to disable trackpoint doubletap
Date: Wed, 17 Apr 2024 13:31:09 -0400 [thread overview]
Message-ID: <20240417173124.9953-4-mpearson-lenovo@squebb.ca> (raw)
In-Reply-To: <20240417173124.9953-1-mpearson-lenovo@squebb.ca>
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@squebb.ca>
Signed-off-by: Vishnu Sankar <vishnuocv@gmail.com>
---
Changes in v2:
- Improved comments on keycodes in init function
drivers/platform/x86/thinkpad_acpi.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index a2f21e958d39..370b9285156c 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 */
@@ -356,6 +357,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;
@@ -3346,7 +3348,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
KEY_HANGUP_PHONE, /* Decline incoming call */
KEY_UNKNOWN, /* AMT_TOGGLE handled in driver, 0x31a */
KEY_UNKNOWN, /* Camera Shutter Switch, 0X31b */
- KEY_UNKNOWN, /* DOUBLETAP_TOGGLE, 0x31c */
+ KEY_UNKNOWN, /* DOUBLETAP_TOGGLE handled in driver, 0x31c */
KEY_VENDOR, /* System debug info, 0x31D */
KEY_PROG1, /* Trackpoint doubletap */
},
@@ -3606,6 +3608,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;
}
@@ -3747,6 +3752,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;
}
@@ -4011,7 +4017,7 @@ static bool hotkey_notify_6xxx(const u32 hkey,
static bool hotkey_notify_8xxx(const u32 hkey)
{
- if (hkey == TP_HKEY_EV_TRACK_DOUBLETAP) {
+ if (hkey == TP_HKEY_EV_TRACK_DOUBLETAP && tp_features.trackpoint_doubletap) {
tpacpi_input_send_key(TP_ACPI_HOTKEYSCAN_DOUBLETAP);
return true;
}
@@ -11229,6 +11235,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)
--
2.44.0
prev parent reply other threads:[~2024-04-17 17:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-17 17:31 [PATCH v2 1/4] platform/x86: thinkpad_acpi: simplify known_ev handling Mark Pearson
2024-04-17 17:31 ` [PATCH v2 2/4] platform/x86: thinkpad_acpi: Support for trackpoint doubletap Mark Pearson
2024-04-17 19:39 ` Hans de Goede
2024-04-17 20:06 ` Hans de Goede
2024-04-17 23:57 ` Mark Pearson
2024-04-18 11:34 ` Hans de Goede
2024-04-18 12:24 ` Mark Pearson
2024-04-18 14:42 ` Hans de Goede
2024-04-18 15:03 ` Mark Pearson
2024-04-17 17:31 ` [PATCH v2 3/4] platform/x86: thinkpad_acpi: Support for system debug info hotkey Mark Pearson
2024-04-17 17:31 ` Mark Pearson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240417173124.9953-4-mpearson-lenovo@squebb.ca \
--to=mpearson-lenovo@squebb.ca \
--cc=hdegoede@redhat.com \
--cc=hmh@hmh.eng.br \
--cc=ibm-acpi-devel@lists.sourceforge.net \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=njoshi1@lenovo.com \
--cc=peter.hutterer@redhat.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=vishnuocv@gmail.com \
--cc=vsankar@lenovo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®