Skip to content

Commit 5f3518d

Browse files
lehmanjuJiri Kosina
authored andcommitted
HID: magicmouse: fix battery reporting for Apple Magic Trackpad 2
Battery reporting does not work for the Apple Magic Trackpad 2 if it is connected via USB. The current hid descriptor fixup code checks for a hid descriptor length of exactly 83 bytes. If the hid descriptor is larger, which is the case for newer apple mice, the fixup is not applied. This fix checks for hid descriptor sizes greater/equal 83 bytes which applies the fixup for newer devices as well. Signed-off-by: Julius Lehmann <lehmanju@devpi.de> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 97d5c8f commit 5f3518d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/hid/hid-magicmouse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ static const __u8 *magicmouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
990990
*/
991991
if ((is_usb_magicmouse2(hdev->vendor, hdev->product) ||
992992
is_usb_magictrackpad2(hdev->vendor, hdev->product)) &&
993-
*rsize == 83 && rdesc[46] == 0x84 && rdesc[58] == 0x85) {
993+
*rsize >= 83 && rdesc[46] == 0x84 && rdesc[58] == 0x85) {
994994
hid_info(hdev,
995995
"fixing up magicmouse battery report descriptor\n");
996996
*rsize = *rsize - 1;

0 commit comments

Comments
 (0)