[PATCH] HID: magicmouse: fix battery reporting for Apple Magic Trackpad 2

Julius Lehmann posted 1 patch 1 month, 2 weeks ago
There is a newer version of this series
drivers/hid/hid-magicmouse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] HID: magicmouse: fix battery reporting for Apple Magic Trackpad 2
Posted by Julius Lehmann 1 month, 2 weeks ago
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>
---
 drivers/hid/hid-magicmouse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index 7d4a25c6de0eb7d36ad26a867004d58a1b6eae71..3fe191615a6d39fbe823e9e1a80fc65a7a12b9c4 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -985,7 +985,7 @@ static const __u8 *magicmouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 	 */
 	if ((is_usb_magicmouse2(hdev->vendor, hdev->product) ||
 	     is_usb_magictrackpad2(hdev->vendor, hdev->product)) &&
-	    *rsize == 83 && rdesc[46] == 0x84 && rdesc[58] == 0x85) {
+	    *rsize >= 83 && rdesc[46] == 0x84 && rdesc[58] == 0x85) {
 		hid_info(hdev,
 			 "fixing up magicmouse battery report descriptor\n");
 		*rsize = *rsize - 1;

---
base-commit: d3eeb99bbc99cc5eb94a4a75ed4415a0272254ef
change-id: 20260214-magic-trackpad-usb-battery-5a31b8c62d4f

Best regards,
-- 
Julius Lehmann <lehmanju@devpi.de>
Re: [PATCH] HID: magicmouse: fix battery reporting for Apple Magic Trackpad 2
Posted by Jiri Kosina 1 month, 1 week ago
On Sat, 14 Feb 2026, Julius Lehmann wrote:

> 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.

Applied to hid.git#for-7.0/upstream-fixes. Thanks,

-- 
Jiri Kosina
SUSE Labs