From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Thanh Nguyen <thanhnguyxn07@gmail.com>,
Linus Walleij <linusw@kernel.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: zinitix: don't use finger_mask as bitmask when reporting contacts
Date: Tue, 7 Apr 2026 21:51:30 -0700 [thread overview]
Message-ID: <adXdOjbr0zTiCBph@google.com> (raw)
In-Reply-To: <20260408031440.955-1-thanhnguyxn07@gmail.com>
Hi Thanh,
On Tue, Apr 07, 2026 at 10:14:40PM -0500, Thanh Nguyen wrote:
> The zinitix touchscreen driver was treating touch_event.finger_mask as a
>
> bitmask to iterate through finger slots. However, on some devices (e.g.,
>
> Samsung Galaxy A3 2015), finger_mask behaves as a finger count rather than
>
> a bitmask, causing multitouch to malfunction.
>
> Instead of relying on finger_mask as a bitmask, iterate through all
>
> possible finger slots and check if SUB_BIT_EXIST is set for each slot.
>
> This restores proper multitouch functionality on affected devices.
>
> Fixes: e941dc13fd (")
So this is effectively a revert of e941dc13fd37 ("Input: zinitix - do
not report shadow fingers") and Linus reported that on his device
ignoring finger count/mask field results in "shadow" contains being
reported, so we obviously can not apply this as is.
So the question is whether this is a mask or a count? Could it be that
it is actually a count of reported slots and we need to stop the loop
after we process the "count" number of slots because the rest is simply
on-stack garbage?
Cc-ing Linus who authored the commit in question...
>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=221278
>
> Signed-off-by: Thanh Nguyen <thanhnguyxn07@gmail.com>
> ---
> drivers/input/touchscreen/zinitix.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/input/touchscreen/zinitix.c b/drivers/input/touchscreen/zinitix.c
> index 716d6fa60..b80525443 100644
> --- a/drivers/input/touchscreen/zinitix.c
> +++ b/drivers/input/touchscreen/zinitix.c
> @@ -445,7 +445,6 @@ static irqreturn_t zinitix_ts_irq_handler(int irq, void *bt541_handler)
> struct bt541_ts_data *bt541 = bt541_handler;
> struct i2c_client *client = bt541->client;
> struct touch_event touch_event;
> - unsigned long finger_mask;
> __le16 icon_events;
> int error;
> int i;
> @@ -470,11 +469,12 @@ static irqreturn_t zinitix_ts_irq_handler(int irq, void *bt541_handler)
> zinitix_report_keys(bt541, le16_to_cpu(icon_events));
> }
>
> - finger_mask = touch_event.finger_mask;
> - for_each_set_bit(i, &finger_mask, MAX_SUPPORTED_FINGER_NUM) {
> + /* Process all finger slots and check if they exist, rather than relying on finger_mask as a bitmask.
> + * On some devices (e.g., Samsung A3 2015), finger_mask behaves as finger count rather than bitmask.
> + * Only process contacts that are actually reported as existing. */
> + for (i = 0; i < MAX_SUPPORTED_FINGER_NUM; i++) {
> const struct point_coord *p = &touch_event.point_coord[i];
>
> - /* Only process contacts that are actually reported */
> if (p->sub_status & SUB_BIT_EXIST)
> zinitix_report_finger(bt541, i, p);
> }
Thanks.
--
Dmitry
prev parent reply other threads:[~2026-04-08 4:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-08 3:14 [PATCH] Input: zinitix: don't use finger_mask as bitmask when reporting contacts Thanh Nguyen
2026-04-08 4:51 ` Dmitry Torokhov [this message]
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=adXdOjbr0zTiCBph@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=linusw@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thanhnguyxn07@gmail.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 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.