Add support for alt trackpad on MacBookPro15,1

This commit is contained in:
Aditya Garg
2025-03-18 21:33:42 +05:30
parent 4289a443f6
commit a97158c91c
5 changed files with 173 additions and 3 deletions
@@ -1,7 +1,7 @@
From 165066841c211201b3f228f03e18e28423e98e94 Mon Sep 17 00:00:00 2001 From 165066841c211201b3f228f03e18e28423e98e94 Mon Sep 17 00:00:00 2001
From: Aditya Garg <gargaditya08@live.com> From: Aditya Garg <gargaditya08@live.com>
Date: Mon, 10 Mar 2025 22:53:28 +0530 Date: Mon, 10 Mar 2025 22:53:28 +0530
Subject: [PATCH 1/3] HID: quirks: remove T2 devices from hid_mouse_ignore_list Subject: [PATCH 1/5] HID: quirks: remove T2 devices from hid_mouse_ignore_list
In order to use hid-magicmouse for T2 trackpads, we need to In order to use hid-magicmouse for T2 trackpads, we need to
remove them from hid_mouse_ignore_list remove them from hid_mouse_ignore_list
@@ -1,7 +1,7 @@
From cc2712238a3179b046f7cd36a24a9a606b99aa81 Mon Sep 17 00:00:00 2001 From cc2712238a3179b046f7cd36a24a9a606b99aa81 Mon Sep 17 00:00:00 2001
From: Aditya Garg <gargaditya08@live.com> From: Aditya Garg <gargaditya08@live.com>
Date: Mon, 10 Mar 2025 23:03:29 +0530 Date: Mon, 10 Mar 2025 23:03:29 +0530
Subject: [PATCH 2/3] HID: apple: ignore the trackpad on T2 Macs Subject: [PATCH 2/5] HID: apple: ignore the trackpad on T2 Macs
In order to manage the trackpad on T2 Macs by hid-magicmouse driver In order to manage the trackpad on T2 Macs by hid-magicmouse driver
we need to ensure that it is not bound by the hid-apple driver. Use we need to ensure that it is not bound by the hid-apple driver. Use
@@ -1,7 +1,7 @@
From 333c1742167b64aea0802996601b9bdc5aaa0a6e Mon Sep 17 00:00:00 2001 From 333c1742167b64aea0802996601b9bdc5aaa0a6e Mon Sep 17 00:00:00 2001
From: Aditya Garg <gargaditya08@live.com> From: Aditya Garg <gargaditya08@live.com>
Date: Tue, 11 Mar 2025 18:44:06 +0530 Date: Tue, 11 Mar 2025 18:44:06 +0530
Subject: [PATCH 3/3] HID: magicmouse: Add support for trackpads found on T2 Subject: [PATCH 3/5] HID: magicmouse: Add support for trackpads found on T2
Macs Macs
This patch adds support for trackpads found on Macs with the T2 This patch adds support for trackpads found on Macs with the T2
@@ -0,0 +1,82 @@
From 96ae78d70a21e7ba765daf870efc8577092d5ff0 Mon Sep 17 00:00:00 2001
From: Aditya Garg <gargaditya08@live.com>
Date: Tue, 18 Mar 2025 21:25:05 +0530
Subject: [PATCH 4/5] HID: apple: Add necessary IDs and support for replacement
trackpad on MacBookPro15,1
Some third party trackpad replacements like that of HAWSON may have a
different PID than the stock trackpad. This commit adds one such trackpad
to hid-apple.
Signed-off-by: Aditya Garg <gargaditya08@live.com>
---
drivers/hid/hid-apple.c | 4 ++++
drivers/hid/hid-ids.h | 17 +++++++++--------
drivers/hid/hid-quirks.c | 1 +
3 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index fdfbfe6ab..dd84a387e 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -523,6 +523,7 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
table = apple2021_fn_keys;
else if (hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J132 ||
hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680 ||
+ hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680_ALT ||
hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J213)
table = macbookpro_no_esc_fn_keys;
else if (hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J214K ||
@@ -1191,6 +1192,9 @@ static const struct hid_device_id apple_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680),
.driver_data = APPLE_HAS_FN | APPLE_BACKLIGHT_CTL | APPLE_ISO_TILDE_QUIRK |
APPLE_IGNORE_MOUSE },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680_ALT),
+ .driver_data = APPLE_HAS_FN | APPLE_BACKLIGHT_CTL | APPLE_ISO_TILDE_QUIRK |
+ APPLE_IGNORE_MOUSE },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRINGT2_J213),
.driver_data = APPLE_HAS_FN | APPLE_BACKLIGHT_CTL | APPLE_ISO_TILDE_QUIRK |
APPLE_IGNORE_MOUSE },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 192c09c27..f4b803c5b 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -170,14 +170,15 @@
#define USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI 0x0272
#define USB_DEVICE_ID_APPLE_WELLSPRING9_ISO 0x0273
#define USB_DEVICE_ID_APPLE_WELLSPRING9_JIS 0x0274
-#define USB_DEVICE_ID_APPLE_WELLSPRINGT2_J140K 0x027a
-#define USB_DEVICE_ID_APPLE_WELLSPRINGT2_J132 0x027b
-#define USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680 0x027c
-#define USB_DEVICE_ID_APPLE_WELLSPRINGT2_J213 0x027d
-#define USB_DEVICE_ID_APPLE_WELLSPRINGT2_J214K 0x027e
-#define USB_DEVICE_ID_APPLE_WELLSPRINGT2_J223 0x027f
-#define USB_DEVICE_ID_APPLE_WELLSPRINGT2_J230K 0x0280
-#define USB_DEVICE_ID_APPLE_WELLSPRINGT2_J152F 0x0340
+#define USB_DEVICE_ID_APPLE_WELLSPRINGT2_J140K 0x027a
+#define USB_DEVICE_ID_APPLE_WELLSPRINGT2_J132 0x027b
+#define USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680 0x027c
+#define USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680_ALT 0x0278
+#define USB_DEVICE_ID_APPLE_WELLSPRINGT2_J213 0x027d
+#define USB_DEVICE_ID_APPLE_WELLSPRINGT2_J214K 0x027e
+#define USB_DEVICE_ID_APPLE_WELLSPRINGT2_J223 0x027f
+#define USB_DEVICE_ID_APPLE_WELLSPRINGT2_J230K 0x0280
+#define USB_DEVICE_ID_APPLE_WELLSPRINGT2_J152F 0x0340
#define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a
#define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b
#define USB_DEVICE_ID_APPLE_IRCONTROL 0x8240
diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
index 2eb15a7ae..ecfb1c3a8 100644
--- a/drivers/hid/hid-quirks.c
+++ b/drivers/hid/hid-quirks.c
@@ -312,6 +312,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRINGT2_J140K) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRINGT2_J132) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680_ALT) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRINGT2_J213) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRINGT2_J214K) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRINGT2_J223) },
--
2.43.0
@@ -0,0 +1,88 @@
From 8a980335aa7495020760fb507bb906975b864ada Mon Sep 17 00:00:00 2001
From: Aditya Garg <gargaditya08@live.com>
Date: Tue, 18 Mar 2025 21:27:25 +0530
Subject: [PATCH 5/5] HID: magicmouse: Add MacBookPro15,1 replacement trackpad
support
This commit adds support for third party replacement trackpad for
MacBookPro15,1 with a different PID in hid-magicmouse.
Signed-off-by: Aditya Garg <gargaditya08@live.com>
---
drivers/hid/hid-magicmouse.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index eb62752d7..769c31706 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -150,6 +150,17 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie
#define J680_TP_RES_Y \
((J680_TP_MAX_Y - J680_TP_MIN_Y) / (J680_TP_DIMENSION_Y / 100))
+#define J680_ALT_TP_DIMENSION_X (float)16000
+#define J680_ALT_TP_MIN_X -7456
+#define J680_ALT_TP_MAX_X 7976
+#define J680_ALT_TP_RES_X \
+ ((J680_ALT_TP_MAX_X - J680_ALT_TP_MIN_X) / (J680_ALT_TP_DIMENSION_X / 100))
+#define J680_ALT_TP_DIMENSION_Y (float)10000
+#define J680_ALT_TP_MIN_Y -163
+#define J680_ALT_TP_MAX_Y 9283
+#define J680_ALT_TP_RES_Y \
+ ((J680_ALT_TP_MAX_Y - J680_ALT_TP_MIN_Y) / (J680_ALT_TP_DIMENSION_Y / 100))
+
#define J213_TP_DIMENSION_X (float)13500
#define J213_TP_MIN_X -6243
#define J213_TP_MAX_X 6749
@@ -311,6 +322,7 @@ static int magicmouse_enable_multitouch(struct hid_device *hdev)
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J140K:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J132:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680:
+ case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680_ALT:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J213:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J214K:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J223:
@@ -1204,6 +1216,7 @@ static const struct magicmouse_t2_properties magicmouse_t2_configs[] = {
T2_TOUCHPAD_ENTRY(J140K),
T2_TOUCHPAD_ENTRY(J132),
T2_TOUCHPAD_ENTRY(J680),
+ T2_TOUCHPAD_ENTRY(J680_ALT),
T2_TOUCHPAD_ENTRY(J213),
T2_TOUCHPAD_ENTRY(J214K),
T2_TOUCHPAD_ENTRY(J223),
@@ -1439,6 +1452,7 @@ static int magicmouse_probe(struct hid_device *hdev,
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J140K:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J132:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680:
+ case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680_ALT:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J213:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J214K:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J223:
@@ -1471,6 +1485,7 @@ static int magicmouse_probe(struct hid_device *hdev,
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J140K:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J132:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680:
+ case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680_ALT:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J213:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J214K:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J223:
@@ -1552,6 +1567,7 @@ static int magicmouse_probe(struct hid_device *hdev,
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J140K:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J132:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680:
+ case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680_ALT:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J213:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J214K:
case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J223:
@@ -1659,6 +1675,8 @@ static const struct hid_device_id magic_mice[] = {
USB_DEVICE_ID_APPLE_WELLSPRINGT2_J132), .driver_data = 0 },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE,
USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680), .driver_data = 0 },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE,
+ USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680_ALT), .driver_data = 0 },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE,
USB_DEVICE_ID_APPLE_WELLSPRINGT2_J213), .driver_data = 0 },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE,
--
2.43.0