Skip to content

Commit 0aa45fc

Browse files
JoseExpositoJiri Kosina
authored andcommitted
HID: magicmouse: set device name when it has been personalized
If the Apple Magic Trackpad 2 has been connected to a Mac, the name is automatically personalized showing its owner name. For example: "José Expósito's Trackpad". When connected through Bluetooth, the personalized name is reported, however, when connected through USB the generic name is reported. 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 b2dcade commit 0aa45fc

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

drivers/hid/hid-magicmouse.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,10 +535,18 @@ static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hd
535535
__set_bit(REL_HWHEEL_HI_RES, input->relbit);
536536
}
537537
} else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
538-
/* setting the device name to ensure the same driver settings
539-
* get loaded, whether connected through bluetooth or USB
538+
/* If the trackpad has been connected to a Mac, the name is
539+
* automatically personalized, e.g., "José Expósito's Trackpad".
540+
* When connected through Bluetooth, the personalized name is
541+
* reported, however, when connected through USB the generic
542+
* name is reported.
543+
* Set the device name to ensure the same driver settings get
544+
* loaded, whether connected through bluetooth or USB.
540545
*/
541-
input->name = "Apple Inc. Magic Trackpad 2";
546+
if (hdev->vendor == BT_VENDOR_ID_APPLE)
547+
input->name = "Apple Inc. Magic Trackpad 2";
548+
else /* USB_VENDOR_ID_APPLE */
549+
input->name = hdev->name;
542550

543551
__clear_bit(EV_MSC, input->evbit);
544552
__clear_bit(BTN_0, input->keybit);

0 commit comments

Comments
 (0)