From: Vishnu Sankar <vishnuocv@gmail.com>
To: corbet@lwn.net, dmitry.torokhov@gmail.com, hmh@hmh.eng.br,
derekjohn.clark@gmail.com, hansg@kernel.org,
ilpo.jarvinen@linux.intel.com
Cc: mpearson-lenovo@squebb.ca, linux-doc@vger.kernel.org,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
ibm-acpi-devel@lists.sourceforge.net,
platform-driver-x86@vger.kernel.org, vsankar@lenovo.com,
Vishnu Sankar <vishnuocv@gmail.com>
Subject: [PATCH v4 1/3] input: trackpoint - Enable doubletap by default on capable devices
Date: Sat, 29 Nov 2025 09:25:31 +0900 [thread overview]
Message-ID: <20251129002533.9070-2-vishnuocv@gmail.com> (raw)
In-Reply-To: <20251129002533.9070-1-vishnuocv@gmail.com>
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
next prev parent reply other threads:[~2025-11-29 0:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-29 0:25 [PATCH v4 0/3] TrackPoint doubletap enablement and user control Vishnu Sankar
2025-11-29 0:25 ` Vishnu Sankar [this message]
2025-12-11 6:49 ` [PATCH v4 1/3] input: trackpoint - Enable doubletap by default on capable devices Dmitry Torokhov
2025-12-11 14:46 ` 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 14:48 ` Hans de Goede
2025-11-29 0:25 ` [PATCH v4 3/3] Documentation: thinkpad-acpi - Document doubletap_filter attribute Vishnu Sankar
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=20251129002533.9070-2-vishnuocv@gmail.com \
--to=vishnuocv@gmail.com \
--cc=corbet@lwn.net \
--cc=derekjohn.clark@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=hansg@kernel.org \
--cc=hmh@hmh.eng.br \
--cc=ibm-acpi-devel@lists.sourceforge.net \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpearson-lenovo@squebb.ca \
--cc=platform-driver-x86@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).