From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Vishnu Sankar <vishnuocv@gmail.com>
Cc: pali@kernel.org, dmitry.torokhov@gmail.com, hmh@hmh.eng.br,
hansg@kernel.org, tglx@linutronix.de, mingo@kernel.org,
jon_xie@pixart.com, jay_lee@pixart.com, zhoubinbin@loongson.cn,
linux-input@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
ibm-acpi-devel@lists.sourceforge.net,
platform-driver-x86@vger.kernel.org, vsankar@lenovo.com,
Mark Pearson <mpearson-lenovo@squebb.ca>
Subject: Re: [PATCH] x86/Mouse: thinkpad_acpi/Trackpoint: Trackpoint Doubletap handling
Date: Thu, 26 Jun 2025 18:09:47 +0300 (EEST) [thread overview]
Message-ID: <4e846cf1-e7c7-3bb9-d8b3-d266b9dfbc4e@linux.intel.com> (raw)
In-Reply-To: <CABxCQKvt+vreQN1+BWr-XBu+pF81n5fh9Fa59UBsV_hLgpvh3A@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 7091 bytes --]
On Thu, 26 Jun 2025, Vishnu Sankar wrote:
> Hi Ilpo,
>
> Thanks a lot for the comments and guidance.
> Please find my comments inline below.
>
> On Wed, Jun 25, 2025 at 9:07 PM Ilpo Järvinen < ilpo.jarvinen@linux.intel.com >
> wrote:
> On Fri, 20 Jun 2025, Vishnu Sankar wrote:
>
> I don't like the shortlog prefixes (in the subject), please don't make
> confusing prefixes up like that.
>
> Got it.
> I will correct this in V2 (as a patch series).
>
> > Newer ThinkPads have a doubletap feature that needs to be turned
> > ON/OFF via the trackpoint registers.
>
> Don't leave lines short mid-paragraph. Either reflow the paragraph or add
> an empty line in between paragraphs.
>
> Acked.
> Will correct this in V2.
>
> > Systems released from 2023 have doubletap disabled by default and
> > need the feature enabling to be useful.
> >
> > This patch introduces support for exposing and controlling the
> > trackpoint doubletap feature via a sysfs attribute.
> > /sys/devices/platform/thinkpad_acpi/tp_doubletap
> > This can be toggled by an "enable" or a "disable".
>
> This too has too short lines.
>
> Sorry!
> Will do the needful in v2.
>
> >
> > With this implemented we can remove the masking of events, and rely on
>
> "With this implemented" is way too vague wording.
>
> Sorry for this!
> I will make this better.
>
> > HW control instead, when the feature is disabled.
> >
> > Note - Early Thinkpads (pre 2015) used the same register for hysteris
>
> hysteresis ?
>
> Sorry for not being clear.
> It's the trackpoint drag hysteris functionality. Pre-2015 ThinkPads used to have a
> user-configurable drag hysterisis register (0x58).
> Drag hysterisis is not user configurable now.
>
> > control, Check the FW IDs to make sure these are not affected.
>
> This Note feels very much disconnected from the rest. Should be properly
> described and perhaps in own patch (I don't know)?
>
> my bad, it's not FW ID, but PnP ID.
> The older ThinkPad's trackpoint controllers use the same register (0x58) to control
> the drag hysteresis, which is obsolete now.
> Now (on newer systems from 2023) the same register (0x58) is remapped as
> doubletap register.
> Just to exclude those older systems (with drag hysterisis control), we check the PnP
> ID's.
>
> I will give a better commit message in V2.
>
> > trackpoint.h is moved to linux/input/.
>
> This patch doesn't look minimal and seems to be combining many changes
> into one. Please make a patch series out of changes that can be separated
> instead of putting all together.
>
> Understood.
> Will make a patch series on V2
> 0001: Move trackpoint.h to include/linux/input
> 0002: Add new doubletap set/status/capable logics to trackpoint.c
> 0003: Add new trackpoint api's and trackpoint sysfs in thinkpad_acpi.c
Okay, sounds better.
> > +/* 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 eg: is "PNP: LEN030d PNP0f13".
> > + */
> > +bool is_trackpoint_dt_capable(const char *pnp_id)
> > +{
> > + char id[16];
> > +
> > + /* Make sure string starts with "PNP: " */
> > + if (strncmp(pnp_id, "PNP: LEN03", 10) != 0)
>
> We seem to have strstarts().
>
> Thanks a lot for the suggestion.
> Will make use of this.
>
> > + return false;
> > +
> > + /* Extract the first word after "PNP: " */
> > + if (sscanf(pnp_id + 5, "%15s", id) != 1)
> > + return false;
> > +
> > + /* Check if it's blacklisted */
> > + for (size_t i = 0; i < ARRAY_SIZE(dt_incompatible_devices); ++i)
> {
> > + if (strcmp(pnp_id, dt_incompatible_devices[i]) == 0)
>
> Isn't this buggy wrt. the PNP: prefix??
>
> Perhaps it would have been better to just do pnp_id += 5 before sscanf()
> as you don't care about the prefix after that.
>
>
> Understood.
> Shall we have something like the following:
> if (!strstarts(pnp_id, "PNP: LEN03"))
> return false;
>
> id = pnp_id + 5;
>
> for (size_t i = 0; i < ARRAY_SIZE(dt_incompatible_devices); ++i) {
> if (strncmp(id, dt_incompatible_devices[i],
> strlen(dt_incompatible_devices[i])) == 0)
Why did you change to strncmp()?
> > + return sysfs_emit(buf, "%s\n", status ? "enabled" : "disabled");
>
> I'm sure there's an existing helper for this bool -> "enabled"/"disabled"
> conversion (make sure you add the #include if not yet there when you use
> the helper).
>
> Is "bool_to_enabled_disabled(status)" the one that you are referring to?
Please see linux/string_choices.h, but after you change the attribute
name, this won't be required as you can use normal boolean style with 0/1.
> > +}
> > +
> > +static ssize_t tp_doubletap_store(struct device *dev, struct
> device_attribute *attr, const char *buf, size_t count)
> > +{
> > + if (sysfs_streq(buf, "enable")) {
>
> Hmm, should this attribute be named doubletap_enabled and follow the
> usual
> boolean convention instead?
>
> Will change the attribute name as suggested.
Please also use kstrtobool() then to convert the value.
> > + /* enabling the doubletap here */
> > + if (!trackpoint_set_doubletap(true))
> > + tp_features.trackpoint_doubletap_state = true;
> > + } else if (sysfs_streq(buf, "disable")) {
> > + /* disabling the doubletap here */
> > + if (!trackpoint_set_doubletap(false))
> > + tp_features.trackpoint_doubletap_state = false;
> > + } else {
> > + pr_err("ThinkPad ACPI: thinkpad_acpi: Invalid value '%s'
> for tp_doubletap\n", buf);
>
> No, sysfs store function should not spam log like this, returning -EINVAL
> tells the very same thing already.
>
> Acked.
> will be removing the log.
>
> > + return -EINVAL;
> > + }
> > +
> > + return count;
> > +}
--
i.
next prev parent reply other threads:[~2025-06-26 15:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-20 0:42 [PATCH] x86/Mouse: thinkpad_acpi/Trackpoint: Trackpoint Doubletap handling Vishnu Sankar
2025-06-25 12:07 ` Ilpo Järvinen
[not found] ` <CABxCQKvt+vreQN1+BWr-XBu+pF81n5fh9Fa59UBsV_hLgpvh3A@mail.gmail.com>
2025-06-26 15:09 ` Ilpo Järvinen [this message]
[not found] ` <CABxCQKt7SjMhX33WGOTk8hdZf1Hvkp8YYFWJK5v1xcbQQm14nQ@mail.gmail.com>
2025-06-27 7:28 ` Ilpo Järvinen
2025-06-30 11:36 ` Vishnu Sankar
2025-06-27 5:14 ` Dmitry Torokhov
2025-06-29 20:42 ` Mark Pearson
2025-06-29 20:51 ` Pali Rohár
2025-06-30 11:21 ` Vishnu Sankar
2025-06-30 5:20 ` Dmitry Torokhov
2025-06-30 11:50 ` Vishnu Sankar
2025-06-30 19:03 ` Dmitry Torokhov
2025-07-02 8:57 ` Ilpo Järvinen
2025-07-30 10:55 ` Pavel Machek
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=4e846cf1-e7c7-3bb9-d8b3-d266b9dfbc4e@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=dmitry.torokhov@gmail.com \
--cc=hansg@kernel.org \
--cc=hmh@hmh.eng.br \
--cc=ibm-acpi-devel@lists.sourceforge.net \
--cc=jay_lee@pixart.com \
--cc=jon_xie@pixart.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mpearson-lenovo@squebb.ca \
--cc=pali@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=vishnuocv@gmail.com \
--cc=vsankar@lenovo.com \
--cc=zhoubinbin@loongson.cn \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.