From 8a980335aa7495020760fb507bb906975b864ada Mon Sep 17 00:00:00 2001 From: Aditya Garg 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 --- 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