Skip to content

Commit 5768701

Browse files
JoseExpositoJiri Kosina
authored andcommitted
HID: magicmouse: set Magic Trackpad 2021 name
The Apple Magic Trackpad 2021 (3rd generation) has the same product ID as the 2nd generation. However, when connected through Bluetooth, the version has changed from 0x107 to 0x110. The other meaningful change is that the name has dropped the generation number and now it is just "Apple Inc. Magic Trackpad", like the first generation model. Set the device name correctly to ensure the same driver settings are loaded, whether connected via Bluetooth or USB. Signed-off-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent 0aa45fc commit 5768701

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

drivers/hid/hid-magicmouse.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ static bool report_undeciphered;
5151
module_param(report_undeciphered, bool, 0644);
5252
MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state field using a MSC_RAW event");
5353

54+
#define TRACKPAD2_2021_BT_VERSION 0x110
55+
5456
#define TRACKPAD_REPORT_ID 0x28
5557
#define TRACKPAD2_USB_REPORT_ID 0x02
5658
#define TRACKPAD2_BT_REPORT_ID 0x31
@@ -543,10 +545,14 @@ static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hd
543545
* Set the device name to ensure the same driver settings get
544546
* loaded, whether connected through bluetooth or USB.
545547
*/
546-
if (hdev->vendor == BT_VENDOR_ID_APPLE)
547-
input->name = "Apple Inc. Magic Trackpad 2";
548-
else /* USB_VENDOR_ID_APPLE */
548+
if (hdev->vendor == BT_VENDOR_ID_APPLE) {
549+
if (input->id.version == TRACKPAD2_2021_BT_VERSION)
550+
input->name = "Apple Inc. Magic Trackpad";
551+
else
552+
input->name = "Apple Inc. Magic Trackpad 2";
553+
} else { /* USB_VENDOR_ID_APPLE */
549554
input->name = hdev->name;
555+
}
550556

551557
__clear_bit(EV_MSC, input->evbit);
552558
__clear_bit(BTN_0, input->keybit);

0 commit comments

Comments
 (0)