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: <73tdfypdlvpgavq4vnlya3os3nniwxktqhpju4luiec3mpqfwl@7j57v4gzf37h>
Date: Fri, 27 Sep 2024 17:59:00 +0200
From: Benjamin Tissoires <bentiss@...nel.org>
To: Aditya Garg <gargaditya08@...e.com>
Cc: "tzimmermann@...e.de" <tzimmermann@...e.de>, 
	"maarten.lankhorst@...ux.intel.com" <maarten.lankhorst@...ux.intel.com>, "mripard@...nel.org" <mripard@...nel.org>, 
	"airlied@...il.com" <airlied@...il.com>, "daniel@...ll.ch" <daniel@...ll.ch>, 
	Jiri Kosina <jikos@...nel.org>, Thomas Weißschuh <thomas@...ch.de>, 
	Orlando Chamberlain <orlandoch.dev@...il.com>, Kerem Karabay <kekrby@...il.com>, 
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>, "linux-input@...r.kernel.org" <linux-input@...r.kernel.org>, 
	"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>
Subject: Re: [PATCH v5 7/10] HID: multitouch: allow specifying if a device is
 direct in a class

On Aug 17 2024, Aditya Garg wrote:
> From: Kerem Karabay <kekrby@...il.com>
> 
> Currently the driver determines the device type based on the
> application, but this value is not reliable on Apple Touch Bars, where
> the application is HID_DG_TOUCHPAD even though the devices are direct,
> so allow setting it in classes.
> 
> Signed-off-by: Kerem Karabay <kekrby@...il.com>
> Signed-off-by: Aditya Garg <gargaditya08@...e.com>

So that one commit breaks the HID selftests.

For a reproducer:

./tools/testing/selftests/hid/vmtest.sh -- \
  "pip3 install hid-tools attrs pyroute2; \
   pytest -v tools/testing/selftests/hid/tests/ --udevd -k Topseed"

In summary: Topseed devices are weird, and I guess this patch makes them
weirder. Please ensure you do not regress on any known devices (so by
removing '-k Topseed' once this is fixed).

Cheers,
Benjamin

> ---
>  drivers/hid/hid-multitouch.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
> index 60b675cd1..2948fbcbc 100644
> --- a/drivers/hid/hid-multitouch.c
> +++ b/drivers/hid/hid-multitouch.c
> @@ -146,6 +146,7 @@ struct mt_class {
>  	__s32 sn_height;	/* Signal/noise ratio for height events */
>  	__s32 sn_pressure;	/* Signal/noise ratio for pressure events */
>  	__u8 maxcontacts;
> +	bool is_direct;	/* true for touchscreens */
>  	bool is_indirect;	/* true for touchpads */
>  	bool export_all_inputs;	/* do not ignore mouse, keyboards, etc... */
>  };
> @@ -563,13 +564,13 @@ static struct mt_application *mt_allocate_application(struct mt_device *td,
>  	mt_application->application = application;
>  	INIT_LIST_HEAD(&mt_application->mt_usages);
>  
> -	if (application == HID_DG_TOUCHSCREEN)
> +	if (application == HID_DG_TOUCHSCREEN && !td->mtclass.is_indirect)
>  		mt_application->mt_flags |= INPUT_MT_DIRECT;
>  
>  	/*
>  	 * Model touchscreens providing buttons as touchpads.
>  	 */
> -	if (application == HID_DG_TOUCHPAD) {
> +	if (application == HID_DG_TOUCHPAD && !td->mtclass.is_direct) {
>  		mt_application->mt_flags |= INPUT_MT_POINTER;
>  		td->inputmode_value = MT_INPUTMODE_TOUCHPAD;
>  	}
> @@ -1317,6 +1318,9 @@ static int mt_touch_input_configured(struct hid_device *hdev,
>  	if (td->serial_maybe)
>  		mt_post_parse_default_settings(td, app);
>  
> +	if (cls->is_direct)
> +		app->mt_flags |= INPUT_MT_DIRECT;
> +
>  	if (cls->is_indirect)
>  		app->mt_flags |= INPUT_MT_POINTER;
>  
> -- 
> 2.43.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ