From: Aditya Garg <gargaditya08@live.com>
To: Benjamin Tissoires <bentiss@kernel.org>
Cc: Jiri Kosina <jikos@kernel.org>, Jiri Kosina <jkosina@suse.com>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
Kerem Karabay <kekrby@gmail.com>,
Orlando Chamberlain <orlandoch.dev@gmail.com>,
Aun-Ali Zaidi <admin@kodeit.net>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>
Subject: Re: [PATCH RESEND 5/5] HID: multitouch: add device ID for Apple Touch Bar
Date: Tue, 25 Mar 2025 13:38:15 +0000 [thread overview]
Message-ID: <PN3PR01MB95979F7D629681CBBCB763ACB8A72@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <vx6hvspvlfsv3palzvjpvsrmkl6s7qut366bhxq3tcwvyf7z63@drzftehh2rew>
> On 25 Mar 2025, at 6:43 PM, Benjamin Tissoires <bentiss@kernel.org> wrote:
>
> On Mar 10 2025, Aditya Garg wrote:
>> From: Kerem Karabay <kekrby@gmail.com>
>>
>> This patch adds the device ID of Apple Touch Bar found on x86 MacBook Pros
>> to the hid-multitouch driver.
>>
>> Note that this is device ID is for T2 Macs. Testing on T1 Macs would be
>> appreciated.
>>
>> Signed-off-by: Kerem Karabay <kekrby@gmail.com>
>> Co-developed-by: Aditya Garg <gargaditya08@live.com>
>> Signed-off-by: Aditya Garg <gargaditya08@live.com>
>> ---
>> drivers/hid/Kconfig | 1 +
>> drivers/hid/hid-multitouch.c | 25 +++++++++++++++++++++----
>> 2 files changed, 22 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
>> index dfc245867..727a2ed0d 100644
>> --- a/drivers/hid/Kconfig
>> +++ b/drivers/hid/Kconfig
>> @@ -743,6 +743,7 @@ config HID_MULTITOUCH
>> Say Y here if you have one of the following devices:
>> - 3M PCT touch screens
>> - ActionStar dual touch panels
>> + - Apple Touch Bar on x86 MacBook Pros
>> - Atmel panels
>> - Cando dual touch panels
>> - Chunghwa panels
>> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
>> index 66e33a482..078ceef62 100644
>> --- a/drivers/hid/hid-multitouch.c
>> +++ b/drivers/hid/hid-multitouch.c
>> @@ -221,6 +221,7 @@ static void mt_post_parse(struct mt_device *td, struct mt_application *app);
>> #define MT_CLS_GOOGLE 0x0111
>> #define MT_CLS_RAZER_BLADE_STEALTH 0x0112
>> #define MT_CLS_SMART_TECH 0x0113
>> +#define MT_CLS_APPLE_TOUCHBAR 0x0114
>> #define MT_CLS_SIS 0x0457
>>
>> #define MT_DEFAULT_MAXCONTACT 10
>> @@ -406,6 +407,12 @@ static const struct mt_class mt_classes[] = {
>> MT_QUIRK_CONTACT_CNT_ACCURATE |
>> MT_QUIRK_SEPARATE_APP_REPORT,
>> },
>> + { .name = MT_CLS_APPLE_TOUCHBAR,
>> + .quirks = MT_QUIRK_HOVERING |
>> + MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE |
>> + MT_QUIRK_APPLE_TOUCHBAR,
>> + .maxcontacts = 11,
>> + },
>> { .name = MT_CLS_SIS,
>> .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
>> MT_QUIRK_ALWAYS_VALID |
>> @@ -1807,6 +1814,15 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
>> }
>> }
>>
>> + ret = hid_parse(hdev);
>> + if (ret != 0)
>> + return ret;
>> +
>> + if (mtclass->name == MT_CLS_APPLE_TOUCHBAR &&
>> + !hid_find_field(hdev, HID_INPUT_REPORT,
>> + HID_DG_TOUCHPAD, HID_DG_TRANSDUCER_INDEX))
>> + return -ENODEV;
>> +
>
> That hunk and the one below make me very nervous. Is there any reason
> preventing you to keep hid_parse() at the same place?
>
Wouldn't we need to parse in order to do hid_find_field? Although I haven't tried putting it at the same place tbh.
> The rest of the series looks fine as everything seems properly guarded
> by MT_CLS_APPLE_TOUCHBAR.
>
> Cheers,
> Benjamin
>
>> td = devm_kzalloc(&hdev->dev, sizeof(struct mt_device), GFP_KERNEL);
>> if (!td) {
>> dev_err(&hdev->dev, "cannot allocate multitouch data\n");
>> @@ -1854,10 +1870,6 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
>>
>> timer_setup(&td->release_timer, mt_expired_timeout, 0);
>>
>> - ret = hid_parse(hdev);
>> - if (ret != 0)
>> - return ret;
>> -
>> if (mtclass->quirks & MT_QUIRK_FIX_CONST_CONTACT_ID)
>> mt_fix_const_fields(hdev, HID_DG_CONTACTID);
>>
>> @@ -2339,6 +2351,11 @@ static const struct hid_device_id mt_devices[] = {
>> MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
>> USB_DEVICE_ID_XIROKU_CSR2) },
>>
>> + /* Apple Touch Bar */
>> + { .driver_data = MT_CLS_APPLE_TOUCHBAR,
>> + HID_USB_DEVICE(USB_VENDOR_ID_APPLE,
>> + USB_DEVICE_ID_APPLE_TOUCHBAR_DISPLAY) },
>> +
>> /* Google MT devices */
>> { .driver_data = MT_CLS_GOOGLE,
>> HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_GOOGLE,
>> --
>> 2.43.0
>>
next prev parent reply other threads:[~2025-03-25 13:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-10 9:10 [PATCH RESEND 0/5] HID: multitouch: Add support for Touch Bars on x86 MacBook Pros Aditya Garg
2025-03-10 9:12 ` [PATCH RESEND 1/5] HID: multitouch: Get the contact ID from HID_DG_TRANSDUCER_INDEX fields in case of Apple Touch Bar Aditya Garg
2025-03-10 9:12 ` [PATCH RESEND 2/5] HID: multitouch: support getting the tip state from HID_DG_TOUCH fields in " Aditya Garg
2025-03-10 9:13 ` [PATCH RESEND 3/5] HID: multitouch: take cls->maxcontacts into account for Apple Touch Bar even without a HID_DG_CONTACTMAX field Aditya Garg
2025-03-10 9:13 ` [PATCH RESEND 4/5] HID: multitouch: specify that Apple Touch Bar is direct Aditya Garg
2025-03-10 9:14 ` [PATCH RESEND 5/5] HID: multitouch: add device ID for Apple Touch Bar Aditya Garg
2025-03-25 13:13 ` Benjamin Tissoires
2025-03-25 13:38 ` Aditya Garg [this message]
2025-03-25 16:11 ` Benjamin Tissoires
2025-03-25 12:52 ` [PATCH RESEND 0/5] HID: multitouch: Add support for Touch Bars on x86 MacBook Pros Jiri Kosina
2025-03-25 13:13 ` Benjamin Tissoires
2025-03-25 17:01 [PATCH RESEND 5/5] HID: multitouch: add device ID for Apple Touch Bar Aditya Garg
2025-03-25 17:05 ` Aditya Garg
2025-03-25 17:29 ` Benjamin Tissoires
2025-03-25 17:31 ` Aditya Garg
2025-03-25 18:05 ` Aditya Garg
2025-03-26 9:54 ` Jiri Kosina
2025-03-26 13:39 ` 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=PN3PR01MB95979F7D629681CBBCB763ACB8A72@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM \
--to=gargaditya08@live.com \
--cc=admin@kodeit.net \
--cc=benjamin.tissoires@redhat.com \
--cc=bentiss@kernel.org \
--cc=jikos@kernel.org \
--cc=jkosina@suse.com \
--cc=kekrby@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=orlandoch.dev@gmail.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®