mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aditya Garg <gargaditya08@live.com>
To: "tzimmermann@suse.de" <tzimmermann@suse.de>,
	"maarten.lankhorst@linux.intel.com"
	<maarten.lankhorst@linux.intel.com>,
	"mripard@kernel.org" <mripard@kernel.org>,
	"airlied@gmail.com" <airlied@gmail.com>,
	"daniel@ffwll.ch" <daniel@ffwll.ch>,
	"Jiri Kosina" <jikos@kernel.org>,
	"bentiss@kernel.org" <bentiss@kernel.org>,
	"Thomas Weißschuh" <thomas@t-8ch.de>
Cc: Orlando Chamberlain <orlandoch.dev@gmail.com>,
	Kerem Karabay <kekrby@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: [PATCH v5 7/10] HID: multitouch: allow specifying if a device is direct in a class
Date: Sat, 17 Aug 2024 11:50:18 +0000	[thread overview]
Message-ID: <013F1B8B-F187-4A9B-9882-0FD174B73860@live.com> (raw)
In-Reply-To: <DD9C41AD-6543-47CE-8504-69E4992229B2@live.com>

From: Kerem Karabay <kekrby@gmail.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@gmail.com>
Signed-off-by: Aditya Garg <gargaditya08@live.com>
---
 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


  parent reply	other threads:[~2024-08-17 11:50 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-17 11:44 [PATCH v5 0/10] Touch Bar support for T2 Macs Aditya Garg
2024-08-17 11:45 ` [PATCH v5 1/10] HID: hid-appletb-bl: add driver for the backlight of Apple Touch Bars Aditya Garg
2024-08-17 11:46 ` [PATCH v5 2/10] HID: hid-appletb-kbd: add driver for the keyboard mode Aditya Garg
2024-09-27 15:39   ` Benjamin Tissoires
2024-09-28  5:56     ` Aditya Garg
2024-08-17 11:47 ` [PATCH v5 3/10] HID: hid-appletb-kbd: add support for fn toggle between media and function mode Aditya Garg
2024-08-17 11:48 ` [PATCH v5 4/10] HID: multitouch: support getting the contact ID from HID_DG_TRANSDUCER_INDEX fields Aditya Garg
2024-09-27 15:56   ` Benjamin Tissoires
2024-08-17 11:48 ` [PATCH v5 5/10] HID: multitouch: support getting the tip state from HID_DG_TOUCH fields Aditya Garg
2024-08-17 11:49 ` [PATCH v5 6/10] HID: multitouch: take cls->maxcontacts into account for devices without a HID_DG_CONTACTMAX field too Aditya Garg
2024-08-17 11:50 ` Aditya Garg [this message]
2024-09-27 15:59   ` [PATCH v5 7/10] HID: multitouch: allow specifying if a device is direct in a class Benjamin Tissoires
2024-08-17 11:50 ` [PATCH v5 8/10] HID: multitouch: add device ID for Apple Touch Bars Aditya Garg
2024-08-17 11:51 ` [PATCH v5 9/10] drm/format-helper: Add conversion from XRGB8888 to BGR888 Aditya Garg
2024-09-27  7:52   ` Thomas Zimmermann
2024-08-17 11:52 ` [PATCH v5 10/10] drm/tiny: add driver for Apple Touch Bars in x86 Macs Aditya Garg
2024-09-27  7:42   ` mripard
2024-09-27 16:48     ` Aditya Garg
2024-09-27  7:48   ` Thomas Zimmermann
2024-09-27 16:49     ` Aditya Garg
2025-02-15 13:43     ` [RFC PATCH " Aditya Garg
2025-02-17  8:04       ` Thomas Zimmermann
2025-02-17 11:43         ` Aditya Garg
2024-08-31 12:37 ` [PATCH v5 0/10] Touch Bar support for T2 Macs Aditya Garg
2024-09-11 12:21   ` Jiri Kosina
2024-09-17 10:06     ` [PATCH v5 0/10] [DRM REVIEW NEEDED] " Aditya Garg
2024-09-26 17:50     ` [WHY SUCH DELAY!] " Aditya Garg
2024-09-26 18:03       ` Jiri Kosina
2024-09-26 18:05         ` Aditya Garg
2024-09-26 18:11           ` Jiri Kosina
2024-09-26 20:37         ` Dave Airlie
2024-09-26 20:39           ` Jiri Kosina
2024-09-27 15:22       ` Benjamin Tissoires
2024-09-27 16:42         ` Aditya Garg

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=013F1B8B-F187-4A9B-9882-0FD174B73860@live.com \
    --to=gargaditya08@live.com \
    --cc=airlied@gmail.com \
    --cc=bentiss@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jikos@kernel.org \
    --cc=kekrby@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=orlandoch.dev@gmail.com \
    --cc=thomas@t-8ch.de \
    --cc=tzimmermann@suse.de \
    /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®