* [PATCH v4 1/3] input: trackpoint - Enable doubletap by default on capable devices
2025-11-29 0:25 [PATCH v4 0/3] TrackPoint doubletap enablement and user control Vishnu Sankar
@ 2025-11-29 0:25 ` Vishnu Sankar
2025-12-11 6:49 ` Dmitry Torokhov
2025-11-29 0:25 ` [PATCH v4 2/3] platform/x86: thinkpad_acpi - Add doubletap_filter sysfs interface Vishnu Sankar
2025-11-29 0:25 ` [PATCH v4 3/3] Documentation: thinkpad-acpi - Document doubletap_filter attribute Vishnu Sankar
2 siblings, 1 reply; 7+ messages in thread
From: Vishnu Sankar @ 2025-11-29 0:25 UTC (permalink / raw)
To: corbet, dmitry.torokhov, hmh, derekjohn.clark, hansg,
ilpo.jarvinen
Cc: mpearson-lenovo, linux-doc, linux-input, linux-kernel,
ibm-acpi-devel, platform-driver-x86, vsankar, Vishnu Sankar
Enable doubletap functionality by default on TrackPoint devices that
support it. The feature is detected using firmware ID pattern matching
(PNP: LEN03xxx) with a deny list of incompatible devices.
This provides immediate doubletap functionality without requiring
userspace configuration. The hardware is enabled during device
detection, while event filtering continues to be handled by the
thinkpad_acpi driver as before.
Signed-off-by: Vishnu Sankar <vishnuocv@gmail.com>
Suggested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
---
Changes in v4:
- Simplified approach: removed all sysfs attributes and user interface
- Enable doubletap by default during device detection
- Removed global variables and complex attribute infrastructure
- Uses minimal firmware ID detection with deny list
- Follows KISS principle as suggested by reviewers
Changes in v3:
- No changes
Changes in v2:
- Improve commit messages
- Sysfs attributes moved to trackpoint.c
- Removed unnecessary comments
- Removed unnecessary debug messages
- Using strstarts() instead of strcmp()
- is_trackpoint_dt_capable() modified
- Removed _BIT suffix and used BIT() define
- Reverse the trackpoint_doubletap_status() logic to return error first
- Removed export functions as a result of the design change
- Changed trackpoint_dev->psmouse to parent_psmouse
- The path of trackpoint.h is not changed
---
drivers/input/mouse/trackpoint.c | 51 ++++++++++++++++++++++++++++++++
drivers/input/mouse/trackpoint.h | 5 ++++
2 files changed, 56 insertions(+)
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c
index 5f6643b69a2c..67144c27bccd 100644
--- a/drivers/input/mouse/trackpoint.c
+++ b/drivers/input/mouse/trackpoint.c
@@ -393,6 +393,48 @@ static int trackpoint_reconnect(struct psmouse *psmouse)
return 0;
}
+/* List of known incapable device PNP IDs */
+static const char * const dt_incompatible_devices[] = {
+ "LEN0304",
+ "LEN0306",
+ "LEN0317",
+ "LEN031A",
+ "LEN031B",
+ "LEN031C",
+ "LEN031D",
+};
+
+/*
+ * Checks if it's a doubletap capable device
+ * The PNP ID format is "PNP: LEN030d PNP0f13".
+ */
+static bool is_trackpoint_dt_capable(const char *pnp_id)
+{
+ const char *id_start;
+ char id[8];
+ size_t i;
+
+ if (!strstarts(pnp_id, "PNP: LEN03"))
+ return false;
+
+ /* Points to "LEN03xxxx" */
+ id_start = pnp_id + 5;
+ if (sscanf(id_start, "%7s", id) != 1)
+ return false;
+
+ /* Check if it's in the deny list */
+ for (i = 0; i < ARRAY_SIZE(dt_incompatible_devices); i++) {
+ if (strcmp(id, dt_incompatible_devices[i]) == 0)
+ return false;
+ }
+ return true;
+}
+
+static int trackpoint_set_doubletap(struct ps2dev *ps2dev, bool enable)
+{
+ return trackpoint_write(ps2dev, TP_DOUBLETAP, enable ? TP_DOUBLETAP_ENABLE : TP_DOUBLETAP_DISABLE);
+}
+
int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
{
struct ps2dev *ps2dev = &psmouse->ps2dev;
@@ -470,6 +512,15 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
psmouse->vendor, firmware_id,
(button_info & 0xf0) >> 4, button_info & 0x0f);
+ /* Enable doubletap by default on capable devices */
+ if (is_trackpoint_dt_capable(ps2dev->serio->firmware_id)) {
+ int error = trackpoint_set_doubletap(ps2dev, true);
+ if (!error)
+ psmouse_info(psmouse, "Doubletap enabled by default!\n");
+ else
+ psmouse_warn(psmouse, "Failed to enable doubletap: %d\n", error);
+ }
+
return 0;
}
diff --git a/drivers/input/mouse/trackpoint.h b/drivers/input/mouse/trackpoint.h
index eb5412904fe0..3e03cdb39449 100644
--- a/drivers/input/mouse/trackpoint.h
+++ b/drivers/input/mouse/trackpoint.h
@@ -69,6 +69,8 @@
/* (how hard it is to drag */
/* with Z-axis pressed) */
+#define TP_DOUBLETAP 0x58 /* TrackPoint doubletap register */
+
#define TP_MINDRAG 0x59 /* Minimum amount of force needed */
/* to trigger dragging */
@@ -110,6 +112,9 @@
external device will be forced to 1 */
#define TP_MASK_EXT_TAG 0x04
+/* Doubletap register values */
+#define TP_DOUBLETAP_ENABLE 0xFF /* Enable value */
+#define TP_DOUBLETAP_DISABLE 0xFE /* Disable value */
/* Power on Self Test Results */
#define TP_POR_SUCCESS 0x3B
--
2.51.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v4 1/3] input: trackpoint - Enable doubletap by default on capable devices
2025-11-29 0:25 ` [PATCH v4 1/3] input: trackpoint - Enable doubletap by default on capable devices Vishnu Sankar
@ 2025-12-11 6:49 ` Dmitry Torokhov
2025-12-11 14:46 ` Vishnu Sankar
0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Torokhov @ 2025-12-11 6:49 UTC (permalink / raw)
To: Vishnu Sankar
Cc: corbet, hmh, derekjohn.clark, hansg, ilpo.jarvinen,
mpearson-lenovo, linux-doc, linux-input, linux-kernel,
ibm-acpi-devel, platform-driver-x86, vsankar
Hi Vishnu,
On Sat, Nov 29, 2025 at 09:25:31AM +0900, Vishnu Sankar wrote:
> Enable doubletap functionality by default on TrackPoint devices that
> support it. The feature is detected using firmware ID pattern matching
> (PNP: LEN03xxx) with a deny list of incompatible devices.
>
> This provides immediate doubletap functionality without requiring
> userspace configuration. The hardware is enabled during device
> detection, while event filtering continues to be handled by the
> thinkpad_acpi driver as before.
>
> Signed-off-by: Vishnu Sankar <vishnuocv@gmail.com>
> Suggested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
> ---
> Changes in v4:
> - Simplified approach: removed all sysfs attributes and user interface
> - Enable doubletap by default during device detection
> - Removed global variables and complex attribute infrastructure
> - Uses minimal firmware ID detection with deny list
> - Follows KISS principle as suggested by reviewers
>
> Changes in v3:
> - No changes
>
> Changes in v2:
> - Improve commit messages
> - Sysfs attributes moved to trackpoint.c
> - Removed unnecessary comments
> - Removed unnecessary debug messages
> - Using strstarts() instead of strcmp()
> - is_trackpoint_dt_capable() modified
> - Removed _BIT suffix and used BIT() define
> - Reverse the trackpoint_doubletap_status() logic to return error first
> - Removed export functions as a result of the design change
> - Changed trackpoint_dev->psmouse to parent_psmouse
> - The path of trackpoint.h is not changed
> ---
> drivers/input/mouse/trackpoint.c | 51 ++++++++++++++++++++++++++++++++
> drivers/input/mouse/trackpoint.h | 5 ++++
> 2 files changed, 56 insertions(+)
>
> diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c
> index 5f6643b69a2c..67144c27bccd 100644
> --- a/drivers/input/mouse/trackpoint.c
> +++ b/drivers/input/mouse/trackpoint.c
> @@ -393,6 +393,48 @@ static int trackpoint_reconnect(struct psmouse *psmouse)
> return 0;
> }
>
> +/* List of known incapable device PNP IDs */
> +static const char * const dt_incompatible_devices[] = {
> + "LEN0304",
> + "LEN0306",
> + "LEN0317",
> + "LEN031A",
> + "LEN031B",
> + "LEN031C",
> + "LEN031D",
> +};
> +
> +/*
> + * Checks if it's a doubletap capable device
Please finish the sentence with a period.
> + * The PNP ID format is "PNP: LEN030d PNP0f13".
> + */
> +static bool is_trackpoint_dt_capable(const char *pnp_id)
Let's call it trackpoint_is_dt_capable() to keep with common
"trackpoint_" prefix in the file.
> +{
> + const char *id_start;
> + char id[8];
> + size_t i;
> +
> + if (!strstarts(pnp_id, "PNP: LEN03"))
> + return false;
> +
> + /* Points to "LEN03xxxx" */
> + id_start = pnp_id + 5;
> + if (sscanf(id_start, "%7s", id) != 1)
> + return false;
> +
> + /* Check if it's in the deny list */
> + for (i = 0; i < ARRAY_SIZE(dt_incompatible_devices); i++) {
> + if (strcmp(id, dt_incompatible_devices[i]) == 0)
Why can't we use strncmp(pnp_id + 5, dt_incompatible_devices[i], 7) here
(after ensuring that pnp_id is of sufficient length to begin with) and
avoid sscanf()?
> + return false;
> + }
> + return true;
> +}
> +
> +static int trackpoint_set_doubletap(struct ps2dev *ps2dev, bool enable)
> +{
> + return trackpoint_write(ps2dev, TP_DOUBLETAP, enable ? TP_DOUBLETAP_ENABLE : TP_DOUBLETAP_DISABLE);
> +}
This wrapper seems an overkill given that it is called only once and
always to enable the doubletap.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v4 1/3] input: trackpoint - Enable doubletap by default on capable devices
2025-12-11 6:49 ` Dmitry Torokhov
@ 2025-12-11 14:46 ` Vishnu Sankar
0 siblings, 0 replies; 7+ messages in thread
From: Vishnu Sankar @ 2025-12-11 14:46 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: corbet, hmh, derekjohn.clark, hansg, ilpo.jarvinen,
mpearson-lenovo, linux-doc, linux-input, linux-kernel,
ibm-acpi-devel, platform-driver-x86, vsankar
Dimitry,
Thank you so much for the review.
On Thu, Dec 11, 2025 at 3:49 PM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
>
> Hi Vishnu,
>
> On Sat, Nov 29, 2025 at 09:25:31AM +0900, Vishnu Sankar wrote:
> > Enable doubletap functionality by default on TrackPoint devices that
> > support it. The feature is detected using firmware ID pattern matching
> > (PNP: LEN03xxx) with a deny list of incompatible devices.
> >
> > This provides immediate doubletap functionality without requiring
> > userspace configuration. The hardware is enabled during device
> > detection, while event filtering continues to be handled by the
> > thinkpad_acpi driver as before.
> >
> > Signed-off-by: Vishnu Sankar <vishnuocv@gmail.com>
> > Suggested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
> > ---
> > Changes in v4:
> > - Simplified approach: removed all sysfs attributes and user interface
> > - Enable doubletap by default during device detection
> > - Removed global variables and complex attribute infrastructure
> > - Uses minimal firmware ID detection with deny list
> > - Follows KISS principle as suggested by reviewers
> >
> > Changes in v3:
> > - No changes
> >
> > Changes in v2:
> > - Improve commit messages
> > - Sysfs attributes moved to trackpoint.c
> > - Removed unnecessary comments
> > - Removed unnecessary debug messages
> > - Using strstarts() instead of strcmp()
> > - is_trackpoint_dt_capable() modified
> > - Removed _BIT suffix and used BIT() define
> > - Reverse the trackpoint_doubletap_status() logic to return error first
> > - Removed export functions as a result of the design change
> > - Changed trackpoint_dev->psmouse to parent_psmouse
> > - The path of trackpoint.h is not changed
> > ---
> > drivers/input/mouse/trackpoint.c | 51 ++++++++++++++++++++++++++++++++
> > drivers/input/mouse/trackpoint.h | 5 ++++
> > 2 files changed, 56 insertions(+)
> >
> > diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c
> > index 5f6643b69a2c..67144c27bccd 100644
> > --- a/drivers/input/mouse/trackpoint.c
> > +++ b/drivers/input/mouse/trackpoint.c
> > @@ -393,6 +393,48 @@ static int trackpoint_reconnect(struct psmouse *psmouse)
> > return 0;
> > }
> >
> > +/* List of known incapable device PNP IDs */
> > +static const char * const dt_incompatible_devices[] = {
> > + "LEN0304",
> > + "LEN0306",
> > + "LEN0317",
> > + "LEN031A",
> > + "LEN031B",
> > + "LEN031C",
> > + "LEN031D",
> > +};
> > +
> > +/*
> > + * Checks if it's a doubletap capable device
>
> Please finish the sentence with a period.
Got it.
I will complete the sentence in the comment:
>
> > + * The PNP ID format is "PNP: LEN030d PNP0f13".
> > + */
> > +static bool is_trackpoint_dt_capable(const char *pnp_id)
>
> Let's call it trackpoint_is_dt_capable() to keep with common
> "trackpoint_" prefix in the file.
Agreed.
Will use trackpoint_is_dt_capable() instead of is_trackpoint_dt_capable.
>
> > +{
> > + const char *id_start;
> > + char id[8];
> > + size_t i;
> > +
> > + if (!strstarts(pnp_id, "PNP: LEN03"))
> > + return false;
> > +
> > + /* Points to "LEN03xxxx" */
> > + id_start = pnp_id + 5;
> > + if (sscanf(id_start, "%7s", id) != 1)
> > + return false;
> > +
> > + /* Check if it's in the deny list */
> > + for (i = 0; i < ARRAY_SIZE(dt_incompatible_devices); i++) {
> > + if (strcmp(id, dt_incompatible_devices[i]) == 0)
>
> Why can't we use strncmp(pnp_id + 5, dt_incompatible_devices[i], 7) here
> (after ensuring that pnp_id is of sufficient length to begin with) and
> avoid sscanf()?
>
Agreed.
I can avoid the temporary buffer completely and compare directly using
strncmp().
Thank you.
> > + return false;
> > + }
> > + return true;
> > +}
> > +
> > +static int trackpoint_set_doubletap(struct ps2dev *ps2dev, bool enable)
> > +{
> > + return trackpoint_write(ps2dev, TP_DOUBLETAP, enable ? TP_DOUBLETAP_ENABLE : TP_DOUBLETAP_DISABLE);
> > +}
>
> This wrapper seems an overkill given that it is called only once and
> always to enable the doubletap.
Understood.
Will call trackpoint_write() directly instead of using the
trackpoint_set_doubletap() wrapper.
>
> Thanks.
>
> --
> Dmitry
--
Regards,
Vishnu Sankar
+817015150407 (Japan)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v4 2/3] platform/x86: thinkpad_acpi - Add doubletap_filter sysfs interface
2025-11-29 0:25 [PATCH v4 0/3] TrackPoint doubletap enablement and user control Vishnu Sankar
2025-11-29 0:25 ` [PATCH v4 1/3] input: trackpoint - Enable doubletap by default on capable devices Vishnu Sankar
@ 2025-11-29 0:25 ` Vishnu Sankar
2025-11-29 14:48 ` Hans de Goede
2025-11-29 0:25 ` [PATCH v4 3/3] Documentation: thinkpad-acpi - Document doubletap_filter attribute Vishnu Sankar
2 siblings, 1 reply; 7+ messages in thread
From: Vishnu Sankar @ 2025-11-29 0:25 UTC (permalink / raw)
To: corbet, dmitry.torokhov, hmh, derekjohn.clark, hansg,
ilpo.jarvinen
Cc: mpearson-lenovo, linux-doc, linux-input, linux-kernel,
ibm-acpi-devel, platform-driver-x86, vsankar, Vishnu Sankar
Add sysfs interface for controlling TrackPoint doubletap event filtering.
This allows userspace to enable/disable doubletap functionality and
query the current state.
The attribute is available at:
/sys/devices/platform/thinkpad_acpi/doubletap_filter
When set to 1, doubletap events are filtered out (ignored).
When set to 0, doubletap events are processed (default).
This complements the automatic hardware enablement in the trackpoint
driver by providing user control over event processing at the kernel level.
Signed-off-by: Vishnu Sankar <vishnuocv@gmail.com>
Suggested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
---
Changes in v2:
- Updated commit message to clarify dependency on trackpoint driver
- Now handling sysfs read/write of trackpoint driver using file read/write
- Removed sysfs attribute creation of trackpoint double tap here
- Reversed the logic and return false right away
- Dropped unnecessary debug messages
- Using dev_dbg() instead of pr_xxxx()
Changes in v3:
- No changes
Changes in v4:
- Simplified approach: single sysfs attribute for user control
- Clear naming: doubletap_filter instead of doubletap_enabled
- Intuitive behavior: 0=process events, 1=filter events
- No cross-driver dependencies or complex interactions
- Minimal code changes using existing thinkpad_acpi infrastructure
---
---
drivers/platform/x86/lenovo/thinkpad_acpi.c | 54 +++++++++++++++++++--
1 file changed, 49 insertions(+), 5 deletions(-)
diff --git a/drivers/platform/x86/lenovo/thinkpad_acpi.c b/drivers/platform/x86/lenovo/thinkpad_acpi.c
index cc19fe520ea9..9b646ecff452 100644
--- a/drivers/platform/x86/lenovo/thinkpad_acpi.c
+++ b/drivers/platform/x86/lenovo/thinkpad_acpi.c
@@ -373,7 +373,7 @@ static struct {
u32 hotkey_poll_active:1;
u32 has_adaptive_kbd:1;
u32 kbd_lang:1;
- u32 trackpoint_doubletap:1;
+ u32 trackpoint_doubletap_filter:1;
struct quirk_entry *quirks;
} tp_features;
@@ -3104,8 +3104,35 @@ static void tpacpi_send_radiosw_update(void)
hotkey_radio_sw_notify_change();
}
+static ssize_t doubletap_filter_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ return sysfs_emit(buf, "%d\n", tp_features.trackpoint_doubletap_filter);
+}
+
+static ssize_t doubletap_filter_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ bool filter;
+ int err;
+
+ err = kstrtobool(buf, &filter);
+ if (err)
+ return err;
+
+ tp_features.trackpoint_doubletap_filter = filter;
+ return count;
+}
+
+static DEVICE_ATTR_RW(doubletap_filter);
+
static void hotkey_exit(void)
{
+ if (tpacpi_pdev)
+ device_remove_file(&tpacpi_pdev->dev, &dev_attr_doubletap_filter);
+
mutex_lock(&hotkey_mutex);
hotkey_poll_stop_sync();
dbg_printk(TPACPI_DBG_EXIT | TPACPI_DBG_HKEY,
@@ -3557,8 +3584,22 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
hotkey_poll_setup_safe(true);
- /* Enable doubletap by default */
- tp_features.trackpoint_doubletap = 1;
+ /*
+ * Enable kernel-level doubletap event filtering by default.
+ * This allows doubletap events to reach userspace.
+ */
+ tp_features.trackpoint_doubletap_filter = 1;
+
+ /* Create doubletap_filter sysfs attribute */
+ if (tpacpi_pdev) {
+ int err = device_create_file(&tpacpi_pdev->dev, &dev_attr_doubletap_filter);
+ if (err) {
+ pr_warn("Unable to create doubletap_filter sysfs attribute\n");
+ /* Continue even if sysfs creation fails */
+ } else {
+ pr_info("ThinkPad ACPI doubletap_filter sysfs attribute created\n");
+ }
+ }
return 0;
}
@@ -3863,7 +3904,8 @@ static bool hotkey_notify_8xxx(const u32 hkey, bool *send_acpi_ev)
{
switch (hkey) {
case TP_HKEY_EV_TRACK_DOUBLETAP:
- if (tp_features.trackpoint_doubletap)
+ /* Only send the event if kernel-level filtering allows it */
+ if (tp_features.trackpoint_doubletap_filter)
tpacpi_input_send_key(hkey, send_acpi_ev);
return true;
@@ -11285,7 +11327,9 @@ static bool tpacpi_driver_event(const unsigned int hkey_event)
mutex_unlock(&tpacpi_inputdev_send_mutex);
return true;
case TP_HKEY_EV_DOUBLETAP_TOGGLE:
- tp_features.trackpoint_doubletap = !tp_features.trackpoint_doubletap;
+ /* Toggle kernel-level doubletap event filtering */
+ tp_features.trackpoint_doubletap_filter =
+ !tp_features.trackpoint_doubletap_filter;
return true;
case TP_HKEY_EV_PROFILE_TOGGLE:
case TP_HKEY_EV_PROFILE_TOGGLE2:
--
2.51.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v4 2/3] platform/x86: thinkpad_acpi - Add doubletap_filter sysfs interface
2025-11-29 0:25 ` [PATCH v4 2/3] platform/x86: thinkpad_acpi - Add doubletap_filter sysfs interface Vishnu Sankar
@ 2025-11-29 14:48 ` Hans de Goede
0 siblings, 0 replies; 7+ messages in thread
From: Hans de Goede @ 2025-11-29 14:48 UTC (permalink / raw)
To: Vishnu Sankar, corbet, dmitry.torokhov, hmh, derekjohn.clark,
ilpo.jarvinen
Cc: mpearson-lenovo, linux-doc, linux-input, linux-kernel,
ibm-acpi-devel, platform-driver-x86, vsankar
Hi Vishnu,
On 29-Nov-25 1:25 AM, Vishnu Sankar wrote:
> Add sysfs interface for controlling TrackPoint doubletap event filtering.
> This allows userspace to enable/disable doubletap functionality and
> query the current state.
>
> The attribute is available at:
> /sys/devices/platform/thinkpad_acpi/doubletap_filter
>
> When set to 1, doubletap events are filtered out (ignored).
> When set to 0, doubletap events are processed (default).
>
> This complements the automatic hardware enablement in the trackpoint
> driver by providing user control over event processing at the kernel level.
>
> Signed-off-by: Vishnu Sankar <vishnuocv@gmail.com>
> Suggested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
> ---
> Changes in v2:
> - Updated commit message to clarify dependency on trackpoint driver
> - Now handling sysfs read/write of trackpoint driver using file read/write
> - Removed sysfs attribute creation of trackpoint double tap here
> - Reversed the logic and return false right away
> - Dropped unnecessary debug messages
> - Using dev_dbg() instead of pr_xxxx()
>
> Changes in v3:
> - No changes
>
> Changes in v4:
> - Simplified approach: single sysfs attribute for user control
> - Clear naming: doubletap_filter instead of doubletap_enabled
> - Intuitive behavior: 0=process events, 1=filter events
> - No cross-driver dependencies or complex interactions
> - Minimal code changes using existing thinkpad_acpi infrastructure
> ---
> ---
> drivers/platform/x86/lenovo/thinkpad_acpi.c | 54 +++++++++++++++++++--
> 1 file changed, 49 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/platform/x86/lenovo/thinkpad_acpi.c b/drivers/platform/x86/lenovo/thinkpad_acpi.c
> index cc19fe520ea9..9b646ecff452 100644
> --- a/drivers/platform/x86/lenovo/thinkpad_acpi.c
> +++ b/drivers/platform/x86/lenovo/thinkpad_acpi.c
> @@ -373,7 +373,7 @@ static struct {
> u32 hotkey_poll_active:1;
> u32 has_adaptive_kbd:1;
> u32 kbd_lang:1;
> - u32 trackpoint_doubletap:1;
> + u32 trackpoint_doubletap_filter:1;
Why the rename? The new name suggests that events will be filtered
when trackpoint_doubletap_filter = 1, so inverted of the old name
but when processing events events are let through when
trackpoint_doubletap_filter == 1 so 1 means _not_ filtering which
makes the name weird:
> + /* Only send the event if kernel-level filtering allows it */
> + if (tp_features.trackpoint_doubletap_filter)
> tpacpi_input_send_key(hkey, send_acpi_ev);
Maybe you forgot to add an '!' here, iow this should become:
/* Only send the event if kernel-level filtering allows it */
if (!tp_features.trackpoint_doubletap_filter)
tpacpi_input_send_key(hkey, send_acpi_ev);
?
> struct quirk_entry *quirks;
> } tp_features;
>
> @@ -3104,8 +3104,35 @@ static void tpacpi_send_radiosw_update(void)
> hotkey_radio_sw_notify_change();
> }
>
> +static ssize_t doubletap_filter_show(struct device *dev,
> + struct device_attribute *attr,
> + char *buf)
> +{
> + return sysfs_emit(buf, "%d\n", tp_features.trackpoint_doubletap_filter);
> +}
> +
> +static ssize_t doubletap_filter_store(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + bool filter;
> + int err;
> +
> + err = kstrtobool(buf, &filter);
> + if (err)
> + return err;
> +
> + tp_features.trackpoint_doubletap_filter = filter;
> + return count;
> +}
> +
> +static DEVICE_ATTR_RW(doubletap_filter);
> +
> static void hotkey_exit(void)
> {
> + if (tpacpi_pdev)
> + device_remove_file(&tpacpi_pdev->dev, &dev_attr_doubletap_filter);
> +
New code should not use device_create_file() / device_remove_file() instead
the attribute should be added to hotkey_attributes[] and then the driver
core will automatically add/remove it.
> mutex_lock(&hotkey_mutex);
> hotkey_poll_stop_sync();
> dbg_printk(TPACPI_DBG_EXIT | TPACPI_DBG_HKEY,
> @@ -3557,8 +3584,22 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
>
> hotkey_poll_setup_safe(true);
>
> - /* Enable doubletap by default */
> - tp_features.trackpoint_doubletap = 1;
> + /*
> + * Enable kernel-level doubletap event filtering by default.
> + * This allows doubletap events to reach userspace.
> + */
> + tp_features.trackpoint_doubletap_filter = 1;
Again this seems to be inverted, or if you really want
trackpoint_doubletap_filter to work as an enable flag
then please rename it to trackpoint_doubletap_enable.
> +
> + /* Create doubletap_filter sysfs attribute */
> + if (tpacpi_pdev) {
> + int err = device_create_file(&tpacpi_pdev->dev, &dev_attr_doubletap_filter);
> + if (err) {
> + pr_warn("Unable to create doubletap_filter sysfs attribute\n");
> + /* Continue even if sysfs creation fails */
> + } else {
> + pr_info("ThinkPad ACPI doubletap_filter sysfs attribute created\n");
> + }
> + }
This can be dropped (replaced by adding the attr to hotkey_attributes[].
Regards,
Hans
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v4 3/3] Documentation: thinkpad-acpi - Document doubletap_filter attribute
2025-11-29 0:25 [PATCH v4 0/3] TrackPoint doubletap enablement and user control Vishnu Sankar
2025-11-29 0:25 ` [PATCH v4 1/3] input: trackpoint - Enable doubletap by default on capable devices Vishnu Sankar
2025-11-29 0:25 ` [PATCH v4 2/3] platform/x86: thinkpad_acpi - Add doubletap_filter sysfs interface Vishnu Sankar
@ 2025-11-29 0:25 ` Vishnu Sankar
2 siblings, 0 replies; 7+ messages in thread
From: Vishnu Sankar @ 2025-11-29 0:25 UTC (permalink / raw)
To: corbet, dmitry.torokhov, hmh, derekjohn.clark, hansg,
ilpo.jarvinen
Cc: mpearson-lenovo, linux-doc, linux-input, linux-kernel,
ibm-acpi-devel, platform-driver-x86, vsankar, Vishnu Sankar
Document the doubletap_filter sysfs attribute for ThinkPad ACPI driver.
Signed-off-by: Vishnu Sankar <vishnuocv@gmail.com>
---
.../admin-guide/laptops/thinkpad-acpi.rst | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/Documentation/admin-guide/laptops/thinkpad-acpi.rst b/Documentation/admin-guide/laptops/thinkpad-acpi.rst
index 4ab0fef7d440..a1e84d25e151 100644
--- a/Documentation/admin-guide/laptops/thinkpad-acpi.rst
+++ b/Documentation/admin-guide/laptops/thinkpad-acpi.rst
@@ -1521,6 +1521,26 @@ Currently 2 antenna types are supported as mentioned below:
The property is read-only. If the platform doesn't have support the sysfs
class is not created.
+doubletap_filter
+----------------
+
+sysfs: doubletap_filter
+
+Controls whether TrackPoint doubletap events are filtered out. Doubletap is a
+feature where quickly tapping the TrackPoint twice triggers a special function key event.
+
+The available commands are::
+
+ cat /sys/devices/platform/thinkpad_acpi/doubletap_filter
+ echo 1 | sudo tee /sys/devices/platform/thinkpad_acpi/doubletap_filter
+ echo 0 | sudo tee /sys/devices/platform/thinkpad_acpi/doubletap_filter
+
+Values:
+ * 0 - doubletap events are processed (default)
+ * 1 - doubletap events are filtered out (ignored)
+
+ This setting can also be toggled via the Fn+doubletap hotkey.
+
Auxmac
------
--
2.51.0
^ permalink raw reply related [flat|nested] 7+ messages in thread