lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZoyH2KiYn-tHu8w2@google.com>
Date: Mon, 8 Jul 2024 17:44:08 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Javier Carrasco <javier.carrasco@...fvision.net>
Cc: Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Bastian Hecht <hechtb@...il.com>,
	Michael Riesch <michael.riesch@...fvision.net>,
	linux-input@...r.kernel.org, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, Jeff LaBundy <jeff@...undy.com>
Subject: Re: [PATCH v10 4/4] Input: st1232 - add touch overlays handling

Hi Javier,

On Wed, Jun 26, 2024 at 11:56:16AM +0200, Javier Carrasco wrote:
> Use touch-overlay to support overlay objects such as buttons and a
> resized frame defined in the device tree.
> 
> A key event will be generated if the coordinates of a touch event are
> within the area defined by the button properties.
> 
> Reviewed-by: Jeff LaBundy <jeff@...undy.com>
> Signed-off-by: Javier Carrasco <javier.carrasco@...fvision.net>
> ---
>  drivers/input/touchscreen/st1232.c | 48 +++++++++++++++++++++++++++-----------
>  1 file changed, 34 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c
> index 6475084aee1b..4fa31447dbc1 100644
> --- a/drivers/input/touchscreen/st1232.c
> +++ b/drivers/input/touchscreen/st1232.c
> @@ -22,6 +22,7 @@
>  #include <linux/pm_qos.h>
>  #include <linux/slab.h>
>  #include <linux/types.h>
> +#include <linux/input/touch-overlay.h>
>  
>  #define ST1232_TS_NAME	"st1232-ts"
>  #define ST1633_TS_NAME	"st1633-ts"
> @@ -57,6 +58,7 @@ struct st1232_ts_data {
>  	struct dev_pm_qos_request low_latency_req;
>  	struct gpio_desc *reset_gpio;
>  	const struct st_chip_info *chip_info;
> +	struct list_head touch_overlay_list;
>  	int read_buf_len;
>  	u8 *read_buf;
>  };
> @@ -138,14 +140,20 @@ static int st1232_ts_parse_and_report(struct st1232_ts_data *ts)
>  
>  	for (i = 0; i < ts->chip_info->max_fingers; i++) {
>  		u8 *buf = &ts->read_buf[i * 4];
> +		bool contact = buf[0] & BIT(7);
> +		unsigned int x, y;
>  
> -		if (buf[0] & BIT(7)) {
> -			unsigned int x = ((buf[0] & 0x70) << 4) | buf[1];
> -			unsigned int y = ((buf[0] & 0x07) << 8) | buf[2];
> -
> -			touchscreen_set_mt_pos(&pos[n_contacts],
> -					       &ts->prop, x, y);
> +		if (contact) {
> +			x = ((buf[0] & 0x70) << 4) | buf[1];
> +			y = ((buf[0] & 0x07) << 8) | buf[2];
> +		}
> +		if (touch_overlay_process_event(&ts->touch_overlay_list, input,
> +						contact ? &x : NULL,
> +						contact ? &y : NULL, i))
> +			continue;

So here is the exact issue I was talking about: you are using index of
the contact as a slot, which assumes that the device maintains position
of contacts in the overall event stream. However the driver uses input
core to track and assign slots (see calls to touchscreen_set_mt_pos()
and input_mt_assign_slots() below), which suggest that the touch
controller may reorder positions as needed.

Thanks.

-- 
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ