From patchwork Tue Mar 25 17:57:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Garg X-Patchwork-Id: 876170 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 93AF025E802; Tue, 25 Mar 2025 18:01:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742925715; cv=none; b=Tg/7nnIIu5Z+W4n/QoXZ2KiGPqZKRsP9k7rJDPBJcsD+EdQOMW/DCttj32VTijcVugtO1f1LG+x2VEyqCzCL/OGVbP4BzKDz3Ujk50RIRy4E4+c5A6/IY2nEQfya6C1z5DXNwMQq6g2mDHxcyN8ObaR4z8uql6QeW7mxAhwopn4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742925715; c=relaxed/simple; bh=AABUJV60jkoyk9pf4/HftEI1WuCcagwn1KgS4S9M+Ec=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=etRJzcXxE/xlpNUd4EvB6WMb5q2WCAO7yhKnD47RD6plbwH3U/xFGGEDyAxHnX4c9Xz/NWki1yQ+am5x/jSHqzBT1AcIOPM+g9CoFACCWYfY1n/hu0fSOzVYYRWtTwvRPkSCCRBpdISb7DEqdjFGZUOcASefXdkmzd7Vj65rqAs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Xxzils29; arc=none smtp.client-ip=209.85.216.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Xxzils29" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-2ff187f027fso224301a91.1; Tue, 25 Mar 2025 11:01:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742925712; x=1743530512; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LYHWEs+E0rUU0Aaji7IOwn3khWFDU08OfBnWr8FMw+E=; b=Xxzils29Axle0XkmSCv1tmrtZHtLA0KmJYgtqFf5ZCen+CVkmxVJ6E8jcke9poARne pH5gIPJwfNFRl92u+1Wu4Kzj8PZaxP6QnD64mh/q76BFvLWdoHizzX6RsJENbdG6GPsy k65imo2VR25Hw1s3o7ZzfnzEVqZmCLSZfXlhVTLcMIJB1eq17BiwsIx7LJjy6o+WMJtc bn8MuJO5gQGhtcD1lPKi8l/HJLqmSDlUZvtF4N27wNm+DYM2oX+aknlL197m6AikelKR 6r3xaO52On5qr8DdS103+ZRmAGs10QC/mYxY+PkYMJorWl6DrHITZc6VlLc2A1vtWJfR TROQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742925712; x=1743530512; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LYHWEs+E0rUU0Aaji7IOwn3khWFDU08OfBnWr8FMw+E=; b=dsGGUC7gIOf6RU2IBiNxEzsUuvKTPJrvE96qG3DTsY6O00GngRxxoeQuUgZWAAvLeT eKLq9duT6oXxtffCmfh/wZz9amixypiW9BdYGI2eJyEsLJ//htUazegHJxotPH9ndpvl zYCSOa+n3NQpXh0KGNh/ssIcIqbNsZpdwEAtSyk9BccViqxCaN2C/KxY9NB5YccNxHyE DI2Or+8M2JQaQeHKrJ628B4jbYjd8741uZ9HWilZBpE4mDerVdQluQWCp0xZPJwD9Yb6 l4QNr771eQBodKaSrMpyHmSru2fOZg8LN/nMR3srMWJ+r1LvHIl4hjk25CX6uNwnZ0BT xcdw== X-Forwarded-Encrypted: i=1; AJvYcCU0Czy5RvaWS87/mUa2YtY0XJ0zsCX73uILPEZ9rnoDhz8RIfM8E2aEwFIHYz36LAl8zRyg43MxBBItIzeD@vger.kernel.org, AJvYcCV3UecDYnJbi2Gq05ZBOxK0DR9C3xJK1eKp6ZWO0/dvYrbkIf7M5OswjLBbfNkFyyBXAQTz8ClPZNwySQ==@vger.kernel.org X-Gm-Message-State: AOJu0YznhdTnrKurJk/yRRZ1O2vzKeDqNbsanemY4pY09Zama1I0ygX4 mUHR/rkW7WReEuJHYVutMuMXO7oqYz6jUwOsdgKb7lSqzx8I+hFy X-Gm-Gg: ASbGncts4hDnm55ke+iKZwovvkQ0+e7EVJHIDC1MW0HJ3USqLS6yYd63UeM76Dnr/qR kvbZ7ClM7M/Q7dgQq0qqk6/iw11kq6ivNJvNO2F+jEpfQjQvg94jxnejht7wcHnSepxs5tFAn76 Mw7sBA2yEAK7G+QaZKNgtiROYPLE4TROEOR3f0jjDQIO8jzf0NmbbyXkX+oUEa3dsNaw0KQPrVH vhB00WZ84cLbF4DNKAAyUPtXSCwq7ohmkaxA4sTgLaxS1gCACE9Czi9QwrCyllZyv4zS7hB5QpC PrbJyocQOrbbKeOzBjAhUApAIoRhg8TBhTYhCB0cMvD6oB1mDiSshBjyHaou1ezpo+1mlLF0/qo EUVpVB9ohMBQ2Hf6TZhOOOpttyOVAf1K2zFvMTAt9dDcZAg== X-Google-Smtp-Source: AGHT+IEAikfz1BZgLGfDnLZZKl9QRyIQFDnvGETV4pxBAJSOHVFWcbuTI0SHqkls9wJ5EqQFOC6tuw== X-Received: by 2002:a17:90b:57c6:b0:2fa:1e56:5d82 with SMTP id 98e67ed59e1d1-3037893f30emr870675a91.17.1742925711594; Tue, 25 Mar 2025 11:01:51 -0700 (PDT) Received: from codespaces-3dd663.dxrpqgqhlb3ehogrxrezr215ye.rx.internal.cloudapp.net ([20.192.21.52]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3030f5d8287sm10683796a91.15.2025.03.25.11.01.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Mar 2025 11:01:50 -0700 (PDT) From: adityagarg1208@gmail.com X-Google-Original-From: gargaditya08@live.com To: jikos@kernel.org, jkosina@suse.com, bentiss@kernel.org, benjamin.tissoires@redhat.com Cc: gargaditya08@live.com, kekrby@gmail.com, orlandoch.dev@gmail.com, admin@kodeit.net, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/5] HID: multitouch: Get the contact ID from HID_DG_TRANSDUCER_INDEX fields in case of Apple Touch Bar Date: Tue, 25 Mar 2025 17:57:24 +0000 Message-ID: <20250325180138.15113-2-gargaditya08@live.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250325180138.15113-1-gargaditya08@live.com> References: <20250325180138.15113-1-gargaditya08@live.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Kerem Karabay In Apple Touch Bar, the contact ID is contained in fields with the HID_DG_TRANSDUCER_INDEX usage rather than HID_DG_CONTACTID, thus differing from the HID spec. Add a quirk for the same. Acked-by: Benjamin Tissoires Signed-off-by: Kerem Karabay Co-developed-by: Aditya Garg Signed-off-by: Aditya Garg --- drivers/hid/hid-multitouch.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index e50887a6d..6e7f34a47 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -73,6 +73,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_APPLE_TOUCHBAR BIT(23) #define MT_INPUTMODE_TOUCHSCREEN 0x02 #define MT_INPUTMODE_TOUCHPAD 0x03 @@ -625,6 +626,7 @@ static struct mt_application *mt_find_application(struct mt_device *td, static struct mt_report_data *mt_allocate_report_data(struct mt_device *td, struct hid_report *report) { + struct mt_class *cls = &td->mtclass; struct mt_report_data *rdata; struct hid_field *field; int r, n; @@ -649,7 +651,11 @@ static struct mt_report_data *mt_allocate_report_data(struct mt_device *td, if (field->logical == HID_DG_FINGER || td->hdev->group != HID_GROUP_MULTITOUCH_WIN_8) { for (n = 0; n < field->report_count; n++) { - if (field->usage[n].hid == HID_DG_CONTACTID) { + unsigned int hid = field->usage[n].hid; + + if (hid == HID_DG_CONTACTID || + (cls->quirks & MT_QUIRK_APPLE_TOUCHBAR && + hid == HID_DG_TRANSDUCER_INDEX)) { rdata->is_mt_collection = true; break; } @@ -827,6 +833,14 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi, EV_KEY, BTN_TOUCH); MT_STORE_FIELD(tip_state); return 1; + case HID_DG_TRANSDUCER_INDEX: + /* + * Contact ID in case of Apple Touch Bars is contained + * in fields with HID_DG_TRANSDUCER_INDEX usage. + */ + if (!(cls->quirks & MT_QUIRK_APPLE_TOUCHBAR)) + return 0; + fallthrough; case HID_DG_CONTACTID: MT_STORE_FIELD(contactid); app->touches_by_report++; From patchwork Tue Mar 25 17:57:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Garg X-Patchwork-Id: 876169 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 039F7264F9D; Tue, 25 Mar 2025 18:01:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742925720; cv=none; b=ce70pTr6RrFJ/1KelXXL0khxDEdp0gGfULCWkGr15bCBs7B4i6ZERA44Z4pZ/VFY31fkdKz5lnhySEvEyMCQWnli3pjSTZt+INl42zTLfXHAc9ZwvBqWohzge6Ot0iFV33TudxTkIlawXPeYTHhOgKBf9QQT8T0d71wfGtTqiNI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742925720; c=relaxed/simple; bh=DmY887p1WKX5lnaqaaiXL/2vbBdMl1/fAZQXd7c3lm4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JFCpwNFV2UFDxJ0bxjxvoD5Etaa8IXqDkR0qpBOdhER7GQLX/oOeSknEzSzhKsRFIs+HhwLzDR/CtpEUxpQYtYHk/VbM8fPFFjkGTRJdSLAQZ87amVchB9H20FCAc/dpgkolECNeO7Vdeh6v3sLopTHq0YWLEqRl0/txB+NRMY0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MVcIQKP5; arc=none smtp.client-ip=209.85.216.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MVcIQKP5" Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-30185d00446so121923a91.0; Tue, 25 Mar 2025 11:01:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742925718; x=1743530518; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UuvfQtrxFOajCLHRPepiqXZW8QwhvcCKnYPv4jVs/lA=; b=MVcIQKP5cmYkAwnQhZBJIbBobFmVh96r8q+83lhUVaQvIzpGnvRjjEBwqnjo1p4dcw F0VJwjQOqOt2WOLzIKOE4OIeZjmSGLJEpf17rTiAms1t/0PereDIWojvNOlWnZZsN3fc etfcAEZvtzWy3lKQcPZeVBNIou1g2Ri2eypuyLB8ahZtqDhdVIR7/Qwr/esHreoqOWKH pogssuZmsEhryWSx+TVkWzXxIjhCUDfnUplOBJnRyQw9j2iYFSNkWOKFIA8YKjaI2bdN eJJe4W8nA39HkIn7o64Yd9YWk6px9fEOqBU0zuBpKYgMYuOBBcPfWPOVZ4VbXU0bfsxh LyIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742925718; x=1743530518; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UuvfQtrxFOajCLHRPepiqXZW8QwhvcCKnYPv4jVs/lA=; b=Z7HLM5Ny/CPHbTP6xefMX9yL+VmsMiKqWdvhb7gB7IdFoZBvL0CcgdHJcBC7fgsf2Y c/+GeEx/bSkcvx54/8X8ZjTa0ioCjGEHFMAn50StDKUhXV97vxy9VHX1EAyb3AfHW8Tg b7URORPhSBz6mMj1GzhOFEf/PDC5RTlQr9mB2w7Du+2NDxurfCC4pSJkMGrI5bB+AdIs 7uFW70XMoS3hLuSj0aXq5ej4jV0ISFr2ZxVxR7ak2F9z5DCpyi+IS2ufhuWDIFDjTJRf HBQ6PGgz9HTQwMA5uj6dzE62QhlyRrd9jalvTx9WxVcjm2O2evUd4us0zTUQLKUStvup focg== X-Forwarded-Encrypted: i=1; AJvYcCW0aWBpSQaQEjccEZdg9gGUjSwYpTRMiIhaNEueHSRqlnXu4paGmdRNE5dCiv2eZ6wqWBSrTmJHm1h6/AnG@vger.kernel.org, AJvYcCXzt6+pPm8cJ5xB2G17B82S3wZHUhE/KiXz+Bbt4sJrRa5PD19oKXJYJY2RON6KP67qXDN9tsnE88f3Wg==@vger.kernel.org X-Gm-Message-State: AOJu0Ywg+HROSDjlYBWWc3V8FvX4b7AEAsqsxpgR5OrKXe3KS5Apyxxd LZJG5Hzm7pdGwgG5kuRnKbtM2JQh1+bSgjIPc6Rw73fCEkV14yjS X-Gm-Gg: ASbGncuts4IKZCJTZoXyJUtId2diUoLETSkCmoirWp+UaPRUuPQjJQ6DiaXnsKDSt8c p1KCfAwaNQv9a9dSnsTtkHDnmHFYlOJb6HgAStOlVXGOUkJssmfCnzWSTngYWBuUNr2S5DK+9cU WdKDckeHRyQp0mPFH0z+e098I75QJDk153sri75SdZxTnhSv1giJoSASs5NvFduHhUKEB3QIOnf 7b5lrOULzD+oothzPQ+ynUKd9Ee0VaSuEEcIUjv9rudOnw2pm8hpZNNBNIFis9fOxPffeJaJlcg SUkh1ZlyBNRvLDJ51gRqxQVq/ZBZVDaiHYOsVqE/qI2qqL6HoL9XIuMJuwhDPUSxdZy4HzMieDk VBS1d/uf4X4xZqtbgHYyeRzlUKnxV6xBGDRrcU9xo4phtCQ== X-Google-Smtp-Source: AGHT+IFf5nXjfnmXn2SqYHp/xUZQbvpBP7+ddDwzgARvotWn5NWT4T8OttfSGpJskRqAv5RVvH3cwQ== X-Received: by 2002:a17:90b:3805:b0:2fa:3174:e344 with SMTP id 98e67ed59e1d1-3037895727amr1079358a91.14.1742925718148; Tue, 25 Mar 2025 11:01:58 -0700 (PDT) Received: from codespaces-3dd663.dxrpqgqhlb3ehogrxrezr215ye.rx.internal.cloudapp.net ([20.192.21.52]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3030f5d8287sm10683796a91.15.2025.03.25.11.01.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Mar 2025 11:01:57 -0700 (PDT) From: adityagarg1208@gmail.com X-Google-Original-From: gargaditya08@live.com To: jikos@kernel.org, jkosina@suse.com, bentiss@kernel.org, benjamin.tissoires@redhat.com Cc: gargaditya08@live.com, kekrby@gmail.com, orlandoch.dev@gmail.com, admin@kodeit.net, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/5] HID: multitouch: take cls->maxcontacts into account for Apple Touch Bar even without a HID_DG_CONTACTMAX field Date: Tue, 25 Mar 2025 17:57:26 +0000 Message-ID: <20250325180138.15113-4-gargaditya08@live.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250325180138.15113-1-gargaditya08@live.com> References: <20250325180138.15113-1-gargaditya08@live.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Kerem Karabay In Apple Touch Bar, the HID_DG_CONTACTMAX is not present, but the maximum contact count is still greater than the default. Add quirks for the same. Acked-by: Benjamin Tissoires Signed-off-by: Kerem Karabay Co-developed-by: Aditya Garg Signed-off-by: Aditya Garg --- drivers/hid/hid-multitouch.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 70fdd8cf9..f7fe6aab8 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -1335,6 +1335,13 @@ static int mt_touch_input_configured(struct hid_device *hdev, struct input_dev *input = hi->input; int ret; + /* + * HID_DG_CONTACTMAX field is not present on Apple Touch Bars, + * but the maximum contact count is greater than the default. + */ + if (cls->quirks & MT_QUIRK_APPLE_TOUCHBAR && cls->maxcontacts) + td->maxcontacts = cls->maxcontacts; + if (!td->maxcontacts) td->maxcontacts = MT_DEFAULT_MAXCONTACT; From patchwork Tue Mar 25 17:57:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Garg X-Patchwork-Id: 876168 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA641264A81; Tue, 25 Mar 2025 18:02:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742925728; cv=none; b=HPuo+t/S7QsQXbpkkcVUBb3uCTwikvFS/qqY74mF6LptppFoPTyYlt5JPlBHsbb3Evz8FGTfxNuqx6I7piMpmAmE5XQNDuEsbl0OYxeJ7ocGxtkW2UYrYdWfp5WalXeWFQLaA568Q8PG0NDBMMj0HrXCoRCVG6nvJsiDTsrSd/Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742925728; c=relaxed/simple; bh=8/uMRBh3mK796+LKtfMh2T6yfdl7GLGGRlyEhsLeeyo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nPqm2V2n3Z1+Mi2LlpwGTcof+0ZmlKcKGNoMMfx797waJExGCwHe+NPKd6zmZpq8A9S+zMWVEjS8VQ3HrG/9v/aSz7EZeiDFcucpLs/MhNepvNaX0A+dDZRReJ9l27RHJ5xpDOKg/1E1o35CdaHzO4C1JWLskNC135MaZWywGEk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CAkMI9gF; arc=none smtp.client-ip=209.85.216.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CAkMI9gF" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-2ff694d2d4dso9791878a91.0; Tue, 25 Mar 2025 11:02:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742925726; x=1743530526; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LYYHBv15Cr/EVMsakWkXkgVhCcei5/+8+zGzUiU2emo=; b=CAkMI9gFHaS2upH3WGzQQuUIQLKp5v6sGbZBTjCFT6Yio0Jk5bKHjE5SzbHTxOSTue T3ZGd47+qKbhzigWpZno76MsJ3rHH5lkf/LYj6AjDC9RdYe9SBosFVvbhhQRv7PbCKO/ mmoCs6NYEnZ6o7Orf+smSMlAWpjRUGxxsq0tGPtoQdbnoHgJYydive2ugmh8wI/mcSDb dS6bGa3Utrpi/xajgWMYUDZGMxbuE1XWV7UrBJ+pRz960TtJ9BcqLgrM+6GP9MTXpb6C bnJMKLTPWhCO4y5V69QpM5JOdrChlXs9K0HmuJ0kKEVvPEQNzFLbKMwAH5HqWZDd9OYp G+oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742925726; x=1743530526; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LYYHBv15Cr/EVMsakWkXkgVhCcei5/+8+zGzUiU2emo=; b=YzP/WH2KYYq9argJeXbMQ7wXd913GSv87VtB/RDgz7L9WYG+YB0y12T0CQSDd3Pghu EUNXIlHnkYM0EhSsv2EtKrMqESk1sMdVE9s8UyCGMq048o1F/pCG7AjzOZawlE7ThgA0 mGJBqf1SByJ7QYZ4orJVgy0GeYMMHqTnQXD+CnzBVjy4Gnb0a0zbGL1Nbg447yEFmAeK lEVYhjytPWOt4C7Bn7n53O1i5s78snt6rvEY5gqnesqy81+hlbSR/ReiwMKfdQKhx0P3 IE9hY8LgrIRH+c1vf8u+okX/K28tphCwsqcSEnN6ZMSjsa42EbgFlxsb3GN6PnJHcKDU SWkg== X-Forwarded-Encrypted: i=1; AJvYcCWa9FYv8PC4ONRRWcmxPICbvRbXGNb3H6AwJcAEyjCeTVlrD0bjgY+y/6fuiDMLsJyFtvou0oVyaLYoMQ==@vger.kernel.org, AJvYcCXCONBzMLtw0V5PVqnh1ImL//J65wnp6EoprfCegZH+QIkNp2FCLhH2n7Wr/JjY83RgJTbBJ6UG+9f17Jxa@vger.kernel.org X-Gm-Message-State: AOJu0YxNOm6Kw8Pna05HGXHauiV9Y8Cw1/VDey/h2qhvlcUyA6BRMwwO WVHZ5ul47NjPSFnrSpMwLMhr6cnadbqpW085kuB3t1IU4iOIRvsb X-Gm-Gg: ASbGnctp3/KUkhzMz2Kz/hN0QtGMPBWBrPCWFNp7yNKy1cUAs2L2juMe4GUxrP1yal8 SD0tuWjvu3dIKwg+p0y9IPhphrcdUOhI+qBUKoq78ZmYpXP9BzKWGbiGRObnvkFPbdXARn+x2YW N7IgdRsX75l4XcWkpUH094OIZHZtjkvF5aFmEBNA8OEnXZ72nmYIw39PydkBK2A0lBo2XLfFD0n 67+2qHX0A8Hmpxor3tMjveoMqriSFrMstk13wDaJjP8MjdQjltqsqginy9Vlo+q9f5NrdNk6c1R EMGaD/DObzJMLB5ws2AD3P0cPM4VczNRB64K+cc8asbq/BJYXuZeSHDXky1fAgCN4MqiL+S+aXh xZ2Ycy4RQoy7xqnfjz/FJPBZvxOy8JYGSnGlZlixv92UNcw== X-Google-Smtp-Source: AGHT+IHYM47qfm1E7ymcU+Xe9BxK1rGyJ7v8oKs+A1gv2ti8YqR2w6RZbB5tB4bwdDjes8NbVLJslg== X-Received: by 2002:a17:90b:2541:b0:2ea:5dea:eb0a with SMTP id 98e67ed59e1d1-3030fe56936mr26729547a91.4.1742925725407; Tue, 25 Mar 2025 11:02:05 -0700 (PDT) Received: from codespaces-3dd663.dxrpqgqhlb3ehogrxrezr215ye.rx.internal.cloudapp.net ([20.192.21.52]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3030f5d8287sm10683796a91.15.2025.03.25.11.02.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Mar 2025 11:02:05 -0700 (PDT) From: adityagarg1208@gmail.com X-Google-Original-From: gargaditya08@live.com To: jikos@kernel.org, jkosina@suse.com, bentiss@kernel.org, benjamin.tissoires@redhat.com Cc: gargaditya08@live.com, kekrby@gmail.com, orlandoch.dev@gmail.com, admin@kodeit.net, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/5] HID: multitouch: add device ID for Apple Touch Bar Date: Tue, 25 Mar 2025 17:57:28 +0000 Message-ID: <20250325180138.15113-6-gargaditya08@live.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250325180138.15113-1-gargaditya08@live.com> References: <20250325180138.15113-1-gargaditya08@live.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Kerem Karabay 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 Co-developed-by: Aditya Garg Signed-off-by: Aditya Garg --- drivers/hid/Kconfig | 1 + drivers/hid/hid-multitouch.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index a50325270..403f4517f 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -769,6 +769,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..41d206f80 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 | @@ -1858,6 +1865,11 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) 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; + 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,