mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Oleh Kuzhylnyi" <kuzhylol@gmail.com>
To: "Daniel Golle" <daniel@makrotopia.org>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Hendrik Noack" <hendrik-noack@gmx.de>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Ferass El Hafidi" <funderscore@postmarketos.org>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
	linux-input@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/5] Input: hynitron-cst816x: release gesture keys
Date: Sun, 04 Oct 2026 23:36:33 +0200	[thread overview]
Message-ID: <DLWDLZK1ZVOJ.G23QIUQTEMEC@gmail.com> (raw)
In-Reply-To: <7199967eb45b1c3adcb7efc859380f6f3dbf7bdd.1790944534.git.daniel@makrotopia.org>

On Fri Oct 2, 2026 at 2:47 PM CEST, Daniel Golle wrote:
> The gesture key is reported with the value of the touch flag, so it
> stays pressed once the controller stops reporting the gesture code
> while the finger is still down. Report the press on its own and
> release the keys the input core still holds down on the first report
> that carries no gesture code. Keycodes above KEY_MAX are rejected,
> as that release looks the key state up in the input core's key bitmap.
>
> Fixes: c87a819bec86 ("Input: add driver for Hynitron CST816x series")
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> ---
> v2:
> - reject keycodes above KEY_MAX and publish keycodemax only once the
>   whole array validates (Sashiko AI review)
>
>  static irqreturn_t cst816x_irq_cb(int irq, void *cookie)
>  {
>  	struct cst816x_priv *priv = cookie;
> @@ -181,8 +205,9 @@ static irqreturn_t cst816x_irq_cb(int irq, void *cookie)
>  
>  	if (tch.gest)
>  		input_report_key(priv->input,
> -				 priv->keycode[cst816x_gest_idx(tch.gest)],
> -				 tch.active);
> +				 priv->keycode[cst816x_gest_idx(tch.gest)], 1);

Tested on CST816S setup, found out a subtle issue: cst816x_gest_idx() maps unhandled
single-click (0x05) and long-press (0x0C) gestures to index 4.

Input subsystem ignores SINGLE_TOUCH (code 0x5) events with tch.active == 0 (t: 0).
Instead, reporting index 4 (single-click 0x05 minus 1) with tch.active == 1 falls into BTN_TOOL_TRIPLETAP linux,keycodes element.

As a result every single touch accompanied by BTN_TOOL_TRIPLETAP:
Event: time 1791148663.331439, type 3 (EV_ABS), code 0 (ABS_X), value 117
Event: time 1791148663.331439, type 3 (EV_ABS), code 1 (ABS_Y), value 124
Event: time 1791148663.331439, type 1 (EV_KEY), code 334 (BTN_TOOL_TRIPLETAP), value 0
Event: time 1791148663.331439, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
Event: time 1791148663.331439, -------------- SYN_REPORT ------------
Event: time 1791148663.397477, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0
Event: time 1791148663.397477, -------------- SYN_REPORT ------------
Event: time 1791148663.409413, type 1 (EV_KEY), code 334 (BTN_TOOL_TRIPLETAP), value 1
Event: time 1791148663.409413, -------------- SYN_REPORT ------------

Interrupts:
cst816x 1-0015: x: 127, y: 124, t: 0, g: 0x5 // Finger down (index 4, tch.active == 1)
cst816x 1-0015: x: 117, y: 124, t: 1, g: 0x0
cst816x 1-0015: x: 117, y: 124, t: 1, g: 0x0
cst816x 1-0015: x: 117, y: 124, t: 0, g: 0x0
cst816x 1-0015: x: 117, y: 124, t: 0, g: 0x5 // Finged up (index 4, tch.active == 1)

I suggest either gate the gesture branch on tch.active so a finger-up
single-click never fires a key, or fix cst816x_gest_idx() to map 0x5/0xC
to their own valid slots so they stop aliasing the TRIPLETAP keycode.

Best regards,
Oleh Kuzhylnyi

> +	else
> +		cst816x_release_keys(priv);
>  
>  	input_report_key(priv->input, BTN_TOUCH, tch.active);
>  


  reply	other threads:[~2026-10-04 21:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 12:47 [PATCH v2 0/5] Input: hynitron-cst816x: axes, gesture keys and panel power Daniel Golle
2026-10-02 12:47 ` [PATCH v2 1/5] dt-bindings: input: touchscreen: hynitron,cst816x: axes and panel Daniel Golle
2026-10-04  7:24   ` Krzysztof Kozlowski
2026-10-04  7:29     ` Daniel Golle
2026-10-04  7:33       ` Krzysztof Kozlowski
2026-10-02 12:47 ` [PATCH v2 2/5] Input: hynitron-cst816x: respect touchscreen DT properties Daniel Golle
2026-10-04 20:30   ` Oleh Kuzhylnyi
2026-10-02 12:47 ` [PATCH v2 3/5] Input: hynitron-cst816x: release gesture keys Daniel Golle
2026-10-04 21:36   ` Oleh Kuzhylnyi [this message]
     [not found]   ` <XXX-PASTE-MESSAGE-ID-OF-OLEHS-MAIL>
2026-10-05 17:07     ` Daniel Golle
2026-10-02 12:48 ` [PATCH v2 4/5] Input: hynitron-cst816x: time out gesture key release Daniel Golle
2026-10-02 12:48 ` [PATCH v2 5/5] Input: hynitron-cst816x: power sequence with the panel Daniel Golle

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=DLWDLZK1ZVOJ.G23QIUQTEMEC@gmail.com \
    --to=kuzhylol@gmail.com \
    --cc=arnd@arndb.de \
    --cc=conor+dt@kernel.org \
    --cc=daniel@makrotopia.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=funderscore@postmarketos.org \
    --cc=hendrik-noack@gmx.de \
    --cc=krzk+dt@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=u.kleine-koenig@baylibre.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

all inboxes | Powered by JetHome®