TrackPoint doubletap enablement and user control
Subsystems (6)
v8 cover TrackPoint doubletap enablement and user control
This patch series adds support for TrackPoint doubletap with a clear and simple separation of responsibilities between drivers:
1. Firmware enablement (trackpoint.c):
Automatically enables doubletap on capable hardware during device detection.
2. User control (thinkpad_acpi.c):
Provides a sysfs interface to enable or disable delivery of doubletap events to userspace.
The approach follows the KISS principle:
- The TrackPoint driver enables hardware functionality by default.
- The thinkpad_acpi driver controls whether ACPI doubletap events are delivered, using existing hotkey filtering infrastructure.
- No cross-driver APIs or dual filtering paths are introduced.
Changes in v8:
- Added linux/array_size.h and linux/strings.h to the include lists for ARRAY_SIZE() and strstarts() respectively.
- Better formatting.
- Fix indentation in doubletap_enable sysfs documentation.
Changes in v7:
- Removed unwanted comments and logs
Changes in v6:
- Documentation: fix formatting of the doubletap_enable sysfs attribute description (separate "Values" list)
Changes in v5:
- Rename sysfs attribute from doubletap_filter to doubletap_enable to reflect actual behavior.
- Fix inverted logic so events are delivered only when doubletap is enabled.
- Suppress ACPI hotkey delivery instead of injecting or filtering input events.
- Register the sysfs attribute via hotkey_attributes[] instead of device_create_file().
- Drop unnecessary helper wrappers and debug logging.
- Update Documentation to reflect the new naming and semantics.
Changes in v4:
- Complete redesign based on reviewer feedback.
- trackpoint.c: Simplified to only enable doubletap by default.
- trackpoint.c: Removed all sysfs attributes and global variables.
- trackpoint.c: Uses firmware ID detection with deny list.
- thinkpad_acpi.c: Added sysfs interface for kernel-level event control.
- thinkpad_acpi.c: No cross-driver dependencies.
- Documentation: Updated to reflect simplified sysfs approach.
Changes in v3:
- No changes.
Changes in v2:
- Improved commit messages.
- Removed unnecessary comments and debug messages.
- Switched to strstarts() usage.
- Simplified firmware capability detection logic.
This version addresses the remaining review feedback by correcting the naming and logic inversion, aligning sysfs semantics with behavior, and fully integrating with existing thinkpad_acpi hotkey handling.
Vishnu Sankar (3):
input: trackpoint - Enable doubletap by default on capable devices platform/x86: thinkpad_acpi: Add sysfs control for TrackPoint
double-tap
Documentation: thinkpad-acpi - Document doubletap_enable attribute
.../admin-guide/laptops/thinkpad-acpi.rst | 21 +++++++++ drivers/input/mouse/trackpoint.c | 46 +++++++++++++++++++ drivers/input/mouse/trackpoint.h | 5 ++ drivers/platform/x86/lenovo/thinkpad_acpi.c | 42 ++++++++++++++--- 4 files changed, 107 insertions(+), 7 deletions(-)
Signature · 1 line
2.51.0
PATCH v8 1/3 input: trackpoint - Enable doubletap by default on capable devices
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.
---
Changes in v8:
- Added missing includes (strings.h and array_size.h)
- Better formatting
Changes in v7:
- Removed unwanted comments
- Removed psmouse_info ()
Changes in v6:
- No Changes
Changes in v5:
- Renamed function to trackpoint_is_dt_capable()
- Simplified string comparison without sscanf()
- Removed wrapper function as suggested
- Fixed missing period in comment
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 | 46 ++++++++++++++++++++++++++++++++ drivers/input/mouse/trackpoint.h | 5 ++++ 2 files changed, 51 insertions(+)
drivers/input/mouse/trackpoint.c +46 -0
@@ -5,6 +5,7 @@* Trademarks are the property of their respective owners. */ +#include <linux/array_size.h> #include <linux/slab.h> #include <linux/delay.h> #include <linux/serio.h>
@@ -12,6 +13,7 @@#include <linux/input.h> #include <linux/libps2.h> #include <linux/proc_fs.h> +#include <linux/string.h> #include <linux/uaccess.h> #include "psmouse.h" #include "trackpoint.h"
@@ -393,6 +395,44 @@ 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 trackpoint_is_dt_capable (const char *pnp_id) +{ +size_t i; + +if (!pnp_id) +return false; + +/* Must start with "PNP: LEN03" */ +if (!strstarts (pnp_id,"PNP: LEN03" )) +return false; + +/* Ensure enough length before comparing */ +if (strlen (pnp_id) <12 ) +return false; + +/* Check deny-list */ +for (i =0 ; i <ARRAY_SIZE (dt_incompatible_devices); i++) { +if (!strncmp (pnp_id +5 , dt_incompatible_devices[i],7 )) +return false; + } +return true; +} +int trackpoint_detect (struct psmouse *psmouse,bool set_properties) {struct ps2dev *ps2dev = &psmouse->ps2dev;
@@ -470,6 +510,12 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) psmouse->vendor, firmware_id, (button_info & 0xf0) >> 4, button_info & 0x0f); +if (trackpoint_is_dt_capable (ps2dev->serio->firmware_id)) { + error =trackpoint_write (ps2dev,TP_DOUBLETAP ,TP_DOUBLETAP_ENABLE ); +if (error) +psmouse_warn (psmouse,"Failed to enable doubletap: %d\n" , error); + } +return 0 ; }
drivers/input/mouse/trackpoint.h +5 -0
@@ -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
Signature · 1 line
2.51.0
PATCH v8 2/3 platform/x86: thinkpad_acpi: Add sysfs control for TrackPoint double-tap
In reply to Vishnu SankarAdd a sysfs attribute to enable or disable TrackPoint double-tap hotkey events at the kernel level.
The TrackPoint firmware enables double-tap support automatically. This interface allows userspace to control whether double-tap events are forwarded to userspace.
The attribute is available at:
/sys/devices/platform/thinkpad_acpi/doubletap_enable
0 - Disable double-tap hotkey events
1 - Enable double-tap hotkey events (default)
Filtering is implemented by suppressing ACPI hotkey delivery without injecting synthetic input events.
---
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
Changes in v5:
- Rename doubletap_filter to doubletap_enable to match actual behavior
- Fix inverted logic so events are emitted only when doubletap is enabled
- Register sysfs attribute via hotkey_attributes[] (no device_create_file)
---
--- drivers/platform/x86/lenovo/thinkpad_acpi.c | 42 +++++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-)
drivers/platform/x86/lenovo/thinkpad_acpi.c +35 -7
@@ -374,7 +374,7 @@ static struct { u32 hotkey_poll_active:1; u32 has_adaptive_kbd:1; u32 kbd_lang:1; - u32 trackpoint_doubletap:1; + u32 trackpoint_doubletap_enable:1;struct quirk_entry *quirks; } tp_features;
@@ -3019,6 +3019,31 @@ static const struct attribute_group adaptive_kbd_attr_group = { .attrs = adaptive_kbd_attributes, }; +/* sysfs doubletap enable --------------------------------------------- */ +static ssize_t doubletap_enable_show (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +return sysfs_emit (buf,"%d\n" , tp_features.trackpoint_doubletap_enable); +} + +static ssize_t doubletap_enable_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +bool enable; +int err; + + err =kstrtobool (buf, &enable); +if (err) +return err; + + tp_features.trackpoint_doubletap_enable = enable; +return count; +} + +static DEVICE_ATTR_RW (doubletap_enable); +/* --------------------------------------------------------------------- */ static struct attribute *hotkey_attributes[] = {
@@ -3033,6 +3058,7 @@ static struct attribute *hotkey_attributes[] = { &dev_attr_hotkey_recommended_mask.attr, &dev_attr_hotkey_tablet_mode.attr, &dev_attr_hotkey_radio_sw.attr, + &dev_attr_doubletap_enable.attr, #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL &dev_attr_hotkey_source_mask.attr, &dev_attr_hotkey_poll_freq.attr,
@@ -3558,8 +3584,8 @@ 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 TrackPoint doubletap event reporting by default. */ + tp_features.trackpoint_doubletap_enable =1 ;return 0 ; }
@@ -3864,9 +3890,9 @@ 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) -tpacpi_input_send_key (hkey, send_acpi_ev); - +/* Only send event if doubletap is enabled */ +if (!tp_features.trackpoint_doubletap_enable) + *send_acpi_ev = false;return true;default :return false;
@@ -11488,7 +11514,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_enable = + !tp_features.trackpoint_doubletap_enable;return true;case TP_HKEY_EV_PROFILE_TOGGLE :case TP_HKEY_EV_PROFILE_TOGGLE2 :
Signature · 1 line
2.51.0
PATCH v8 3/3 Documentation: thinkpad-acpi - Document doubletap_enable attribute
In reply to Vishnu SankarDocument the doubletap_enable sysfs attribute for ThinkPad ACPI driver.
---
Changes in v8:
- Fixes indentation
Changes in v7:
- Fix formatting
Changes in v6:
- Fix formatting of doubletap_enable sysfs documentation (separate Values list)
--- .../admin-guide/laptops/thinkpad-acpi.rst | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+)
Documentation/admin-guide/laptops/thinkpad-acpi.rst +21 -0
@@ -1522,6 +1522,27 @@ 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_enable +---------------- + +sysfs: doubletap_enable + +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_enable + echo 1 | sudo tee /sys/devices/platform/thinkpad_acpi/doubletap_enable + echo 0 | sudo tee /sys/devices/platform/thinkpad_acpi/doubletap_enable + +Values: + + * 1 - doubletap events are processed (default) + * 0 - doubletap events are filtered out (ignored) + + This setting can also be toggled via the Fn+doubletap hotkey. + Auxmac ------
Signature · 1 line
2.51.0
Ilpo Järvinen
maintainerQuoted 8 lines · Vishnu Sankar
This patch series adds support for TrackPoint doubletap with a clear and simple separation of responsibilities between drivers:
1. Firmware enablement (
trackpoint.c):
Automatically enables doubletap on capable hardware during device detection.[...]
Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.
The list of commits applied:
[1/3] input: trackpoint - Enable doubletap by default on capable devices
commit: 9a98ebe630cf13c1a6063afa676d1cecc44fb2c9
[2/3] platform/x86: thinkpad_acpi: Add sysfs control for TrackPoint double-tap
commit: 6227cc32fa01ffbf5bef8dcc6759743a28a2ad57
[3/3] Documentation: thinkpad-acpi - Document doubletap_enable attribute
commit: fa5062e99b984448b7c8ca9aea47e7fc033b6e2f--
i.
Hi Ilpo,
Thank you for accepting this.
Quoted 10 lines · Ilpo Järvinen
Quoted 7 lines · Vishnu Sankar
This patch series adds support for TrackPoint doubletap with a clear and simple separation of responsibilities between drivers:
1. Firmware enablement (
trackpoint.c):
Automatically enables doubletap on capable hardware during device detection.
Quoted 7 lines
Quoted 1 line
[...]
Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.
Acked.
Quoted 12 lines
The list of commits applied:
[1/3] input: trackpoint - Enable doubletap by default on capable devicescommit: 9a98ebe630cf13c1a6063afa676d1cecc44fb2c9 [2/3] platform/x86: thinkpad_acpi: Add sysfs control for TrackPoint double-tap commit: 6227cc32fa01ffbf5bef8dcc6759743a28a2ad57 [3/3] Documentation: thinkpad-acpi - Document doubletap_enable attribute commit: fa5062e99b984448b7c8ca9aea47e7fc033b6e2f--
i.
Signature · 3 lines
Regards,
Vishnu Sankar