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>
Cc: Kerem Karabay <kekrby@gmail.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
Orlando Chamberlain <orlandoch.dev@gmail.com>
Subject: [PATCH v2 4/9] HID: multitouch: support getting the tip state from HID_DG_TOUCH fields
Date: Thu, 8 Aug 2024 11:58:14 +0000 [thread overview]
Message-ID: <05F523B5-7307-4022-A2B8-C3C96DA0A92D@live.com> (raw)
In-Reply-To: <9550ADFD-0534-471D-94B4-EF370943CF80@live.com>
From: Kerem Karabay <kekrby@gmail.com>
This is necessary on Apple Touch Bars, where the tip state is contained
in fields with the HID_DG_TOUCH usage. This feature is gated by a quirk
in order to prevent breaking other devices, see commit c2ef8f21ea8f
("HID: multitouch: add support for trackpads").
Signed-off-by: Kerem Karabay <kekrby@gmail.com>
Signed-off-by: Aditya Garg <gargaditya08@live.com>
---
drivers/hid/hid-multitouch.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 3e92789ed..571435da5 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -72,6 +72,7 @@ MODULE_LICENSE("GPL");
#define MT_QUIRK_FORCE_MULTI_INPUT BIT(20)
#define MT_QUIRK_DISABLE_WAKEUP BIT(21)
#define MT_QUIRK_ORIENTATION_INVERT BIT(22)
+#define MT_QUIRK_TOUCH_IS_TIPSTATE BIT(23)
#define MT_INPUTMODE_TOUCHSCREEN 0x02
#define MT_INPUTMODE_TOUCHPAD 0x03
@@ -809,6 +810,15 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
MT_STORE_FIELD(confidence_state);
return 1;
+ case HID_DG_TOUCH:
+ /*
+ * Legacy devices use TIPSWITCH and not TOUCH.
+ * Let's just ignore this field unless the quirk is set.
+ */
+ if (!(cls->quirks & MT_QUIRK_TOUCH_IS_TIPSTATE))
+ return -1;
+
+ fallthrough;
case HID_DG_TIPSWITCH:
if (field->application != HID_GD_SYSTEM_MULTIAXIS)
input_set_capability(hi->input,
@@ -872,10 +882,6 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
case HID_DG_CONTACTMAX:
/* contact max are global to the report */
return -1;
- case HID_DG_TOUCH:
- /* Legacy devices use TIPSWITCH and not TOUCH.
- * Let's just ignore this field. */
- return -1;
}
/* let hid-input decide for the others */
return 0;
--
2.39.3 (Apple Git-146)
next prev parent reply other threads:[~2024-08-08 11:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-08 11:53 [PATCH v2 0/9] Touch Bar support for T2 Macs Aditya Garg
2024-08-08 11:54 ` [PATCH v2 1/9] HID: hid-appletb-bl: add driver for the backlight of Apple Touch Bars Aditya Garg
2024-08-08 11:55 ` [PATCH v2 2/9] HID: hid-appletb-kbd: add driver for the keyboard mode " Aditya Garg
2024-08-08 11:56 ` [PATCH v3 3/9] HID: multitouch: support getting the contact ID from HID_DG_TRANSDUCER_INDEX fields Aditya Garg
2024-08-08 11:58 ` Aditya Garg [this message]
2024-08-08 11:59 ` [PATCH v2 5/9] HID: multitouch: take cls->maxcontacts into account for devices without a HID_DG_CONTACTMAX field too Aditya Garg
2024-08-08 12:00 ` [PATCH v2 6/9] HID: multitouch: allow specifying if a device is direct in a class Aditya Garg
2024-08-08 12:01 ` [PATCH v2 7/9] HID: multitouch: add device ID for Apple Touch Bars Aditya Garg
2024-08-08 12:03 ` [PATCH v2 0/9] Touch Bar support for T2 Macs 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=05F523B5-7307-4022-A2B8-C3C96DA0A92D@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=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