Skip to contentSkip to conversation

TrackPoint doubletap enablement and user control

PATCH Superseded Vishnu Sankar 3 participants 7 messages Nov 29, 2025 – Dec 11, 2025

Subsystems (6)

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v4 cover TrackPoint doubletap enablement and user control

This patch series adds doubletap support for TrackPoint devices with a clean separation of concerns:

1. Firmware enablement (trackpoint.c): Automatically enables doubletap on capable hardware during device detection
2. User control (thinkpad_acpi.c): Provides sysfs interface for controlling event filtering

The simplified approach follows KISS principle:
- Trackpoint driver enables hardware functionality by default
- Thinkpad_acpi driver provides user control via existing filtering
- No cross-driver dependencies or complex interactions

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 simple sysfs interface for event filtering
- thinkpad_acpi.c: Uses clear naming (doubletap_filter)
- 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
- Using strstarts() instead of strcmp()
- Modified is_trackpoint_dt_capable()
- Removed _BIT suffix and used BIT() define

This version addresses the core reviewer feedback by:
- Removing dual filtering complexity
- Following KISS principle with clear separation
- Providing immediate functionality without configuration

Vishnu Sankar (3):
input: trackpoint - Enable doubletap by default on capable devices platform/x86: thinkpad_acpi - Add doubletap_filter sysfs interface
Documentation: thinkpad-acpi - Document doubletap_filter attribute

 .../admin-guide/laptops/thinkpad-acpi.rst     | 20 +++++++
 drivers/input/mouse/trackpoint.c              | 51 ++++++++++++++++++
 drivers/input/mouse/trackpoint.h              |  5 ++
 drivers/platform/x86/lenovo/thinkpad_acpi.c   | 54 +++++++++++++++++--
 4 files changed, 125 insertions(+), 5 deletions(-)
Signature · 1 line
2.51.0
#1 lore raw

PATCH v4 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 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(+)
drivers/input/mouse/trackpoint.c +51 -0
index 5f6643b69a2c..67144c27bccd 100644
@@ -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;
 }
 
drivers/input/mouse/trackpoint.h +5 -0
index eb5412904fe0..3e03cdb39449 100644
@@ -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
#4 lore raw

PATCH v4 2/3 platform/x86: thinkpad_acpi - Add doubletap_filter sysfs interface

In reply to 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.

---
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(-)
drivers/platform/x86/lenovo/thinkpad_acpi.c +49 -5
index cc19fe520ea9..9b646ecff452 100644
@@ -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:
Signature · 1 line
2.51.0
#6 lore raw

PATCH v4 3/3 Documentation: thinkpad-acpi - Document doubletap_filter attribute

In reply to Vishnu Sankar

Document the doubletap_filter sysfs attribute for ThinkPad ACPI driver.

---
 .../admin-guide/laptops/thinkpad-acpi.rst     | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
Documentation/admin-guide/laptops/thinkpad-acpi.rst +20 -0
index 4ab0fef7d440..a1e84d25e151 100644
@@ -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
 ------
 
Signature · 1 line
2.51.0
maintainer
#5 lore raw

Re: [PATCH v4 2/3] platform/x86: thinkpad_acpi - Add doubletap_filter sysfs interface

In reply to Vishnu Sankar

Hi Vishnu,

Quoted 43 lines · 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.

---
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(-)
drivers/platform/x86/lenovo/thinkpad_acpi.c +0 -0
index cc19fe520ea9..9b646ecff452 100644

drivers/platform/x86/lenovo/thinkpad_acpi.c static struct { · line 376

Quoted 5 lines
drivers/platform/x86/lenovo/thinkpad_acpi.c +1 -1
@@ -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:

drivers/platform/x86/lenovo/thinkpad_acpi.c static bool hotkey_notify_8xxx(const u32 hkey, bool *send_acpi_ev) · line 3909

Quoted 3 lines
drivers/platform/x86/lenovo/thinkpad_acpi.c +2 -0
+		/* 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);

?

Quoted 26 lines
drivers/platform/x86/lenovo/thinkpad_acpi.c +19 -0
 	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;

drivers/platform/x86/lenovo/thinkpad_acpi.c static void tpacpi_send_radiosw_update(void) · line 3135

Quoted 10 lines
drivers/platform/x86/lenovo/thinkpad_acpi.c +8 -0
+	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.

Quoted 4 lines
drivers/platform/x86/lenovo/thinkpad_acpi.c +0 -0
 	mutex_lock(&hotkey_mutex);
 	hotkey_poll_stop_sync();
 	dbg_printk(TPACPI_DBG_EXIT | TPACPI_DBG_HKEY,

drivers/platform/x86/lenovo/thinkpad_acpi.c static int __init hotkey_init(struct ibm_init_struct *iibm) · line 3591

Quoted 10 lines
drivers/platform/x86/lenovo/thinkpad_acpi.c +5 -2
@@ -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.

drivers/platform/x86/lenovo/thinkpad_acpi.c static int __init hotkey_init(struct ibm_init_struct *iibm) · line 3602

Quoted 11 lines
drivers/platform/x86/lenovo/thinkpad_acpi.c +11 -0
+
+	/* 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

maintainer
#2 lore raw

Re: [PATCH v4 1/3] input: trackpoint - Enable doubletap by default on capable devices

In reply to Vishnu Sankar

Hi Vishnu,

Quoted 50 lines · 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.

---
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(+)
drivers/input/mouse/trackpoint.c +3 -0
index 5f6643b69a2c..67144c27bccd 100644
@@ -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",

drivers/input/mouse/trackpoint.c static int trackpoint_reconnect(struct psmouse *psmouse) · line 408

Quoted 10 lines
drivers/input/mouse/trackpoint.c +10 -0
+	"LEN0306",
+	"LEN0317",
+	"LEN031A",
+	"LEN031B",
+	"LEN031C",
+	"LEN031D",
+};
+
+/*
+ * Checks if it's a doubletap capable device

Please finish the sentence with a period.

drivers/input/mouse/trackpoint.c static int trackpoint_reconnect(struct psmouse *psmouse) · line 411

Quoted 3 lines
drivers/input/mouse/trackpoint.c +3 -0
+ * 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.

Quoted 6 lines
drivers/input/mouse/trackpoint.c +6 -0
+{
+	const char *id_start;
+	char id[8];
+	size_t i;
+
+	if (!strstarts(pnp_id, "PNP: LEN03"))

drivers/input/mouse/trackpoint.c static int trackpoint_reconnect(struct psmouse *psmouse) · line 427

Quoted 10 lines
drivers/input/mouse/trackpoint.c +10 -0
+		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()?

drivers/input/mouse/trackpoint.c static int trackpoint_reconnect(struct psmouse *psmouse) · line 436

Quoted 9 lines
drivers/input/mouse/trackpoint.c +9 -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);
+}

This wrapper seems an overkill given that it is called only once and always to enable the doubletap.

Thanks.

Signature · 1 line
Dmitry
#3 lore raw

Re: [PATCH v4 1/3] input: trackpoint - Enable doubletap by default on capable devices

Dimitry,

Thank you so much for the review.

Quoted 51 lines · Dmitry Torokhov

Hi Vishnu,

Quoted 47 lines · 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.

---
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(+)
drivers/input/mouse/trackpoint.c +0 -0
index 5f6643b69a2c..67144c27bccd 100644
@@ -393,6 +393,48 @@ static int trackpoint_reconnect(struct psmouse *psmouse)
      return 0;
 }
 
Quoted 15 lines

drivers/input/mouse/trackpoint.c static int trackpoint_reconnect(struct psmouse *psmouse) · line 408

Quoted 13 lines
drivers/input/mouse/trackpoint.c +13 -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:

Quoted 7 lines

drivers/input/mouse/trackpoint.c static int trackpoint_reconnect(struct psmouse *psmouse) · line 411

Quoted 4 lines
drivers/input/mouse/trackpoint.c +3 -0
+ * 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.

Quoted 13 lines
Quoted 13 lines
drivers/input/mouse/trackpoint.c +12 -0
+{
+     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;
Quoted 9 lines

drivers/input/mouse/trackpoint.c static int trackpoint_reconnect(struct psmouse *psmouse) · line 427

Quoted 4 lines
drivers/input/mouse/trackpoint.c +4 -0
+
+     /* 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.

Quoted 4 lines
Quoted 4 lines
drivers/input/mouse/trackpoint.c +4 -0
+                     return false;
+     }
+     return true;
+}
Quoted 8 lines

drivers/input/mouse/trackpoint.c static int trackpoint_reconnect(struct psmouse *psmouse) · line 436

Quoted 5 lines
drivers/input/mouse/trackpoint.c +5 -0
+
+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.

Quoted 5 lines

Thanks.

--
Dmitry

Signature · 4 lines
Regards,

      Vishnu Sankar
     +817015150407 (Japan)