summaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJosé Expósito <jose.exposito89@gmail.com>2021-12-12 19:21:00 +0100
committerJiri Kosina <jkosina@suse.cz>2022-01-06 13:58:29 +0100
commit5768701edcb7d7ff8abaa085996a5c1cb30d765e (patch)
treeaf7a63bc9b486e87ea0b97d1e14e8347512b05a3 /drivers/hid
parentHID: magicmouse: set device name when it has been personalized (diff)
downloadlinux-5768701edcb7d7ff8abaa085996a5c1cb30d765e.tar.xz
linux-5768701edcb7d7ff8abaa085996a5c1cb30d765e.zip
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>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-magicmouse.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index 3e483dd32873..d688610af248 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -51,6 +51,8 @@ static bool report_undeciphered;
module_param(report_undeciphered, bool, 0644);
MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state field using a MSC_RAW event");
+#define TRACKPAD2_2021_BT_VERSION 0x110
+
#define TRACKPAD_REPORT_ID 0x28
#define TRACKPAD2_USB_REPORT_ID 0x02
#define TRACKPAD2_BT_REPORT_ID 0x31
@@ -543,10 +545,14 @@ static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hd
* Set the device name to ensure the same driver settings get
* loaded, whether connected through bluetooth or USB.
*/
- if (hdev->vendor == BT_VENDOR_ID_APPLE)
- input->name = "Apple Inc. Magic Trackpad 2";
- else /* USB_VENDOR_ID_APPLE */
+ if (hdev->vendor == BT_VENDOR_ID_APPLE) {
+ if (input->id.version == TRACKPAD2_2021_BT_VERSION)
+ input->name = "Apple Inc. Magic Trackpad";
+ else
+ input->name = "Apple Inc. Magic Trackpad 2";
+ } else { /* USB_VENDOR_ID_APPLE */
input->name = hdev->name;
+ }
__clear_bit(EV_MSC, input->evbit);
__clear_bit(BTN_0, input->keybit);