Skip to content

Commit 29f556c

Browse files
ckhordiasmagregkh
authored andcommitted
HID: magicmouse: re-enable multitouch after reset-resume
[ Upstream commit 4253fe2 ] When the Apple Magic Trackpad 2 (USB) is reset across a power transition (e.g. resume from hibernation) it drops out of multitouch mode: it keeps sending report ID 0x02 on its HID_TYPE_USBMOUSE interface, but the packet shrinks from 21 to 8 bytes and the trackpad2 handler drops it (size < 12). Clicks still work but pointer motion is lost until the device is re-plugged or the driver reloaded. Re-enable multitouch from .reset_resume via the workqueue. Only .reset_resume is needed; suspend-to-idle keeps the device powered and retains multitouch. Fixes: 87a2f10 ("HID: magicmouse: Apple Magic Trackpad 2 USB-C driver support") Cc: stable@vger.kernel.org Assisted-by: Claude-Code:claude-opus-4-8 Signed-off-by: Christopher Kodama <ckhordiasma@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com> [ kept 6.6's non-const `magicmouse_report_fixup()` signature in context instead of upstream's `static const __u8 *` ] Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8a10a62 commit 29f556c

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

drivers/hid/hid-magicmouse.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,22 @@ static void magicmouse_remove(struct hid_device *hdev)
10081008
hid_hw_stop(hdev);
10091009
}
10101010

1011+
#ifdef CONFIG_PM
1012+
static int magicmouse_reset_resume(struct hid_device *hdev)
1013+
{
1014+
struct magicmouse_sc *msc = hid_get_drvdata(hdev);
1015+
1016+
/* The device drops out of multitouch mode on resume; re-send the
1017+
* enable report. Only the HID_TYPE_USBMOUSE interface accepts it, and
1018+
* it must be deferred. Sending it inline here is too early.
1019+
*/
1020+
if (msc && hdev->type == HID_TYPE_USBMOUSE)
1021+
schedule_delayed_work(&msc->work, msecs_to_jiffies(500));
1022+
1023+
return 0;
1024+
}
1025+
#endif
1026+
10111027
static __u8 *magicmouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
10121028
unsigned int *rsize)
10131029
{
@@ -1067,6 +1083,9 @@ static struct hid_driver magicmouse_driver = {
10671083
.event = magicmouse_event,
10681084
.input_mapping = magicmouse_input_mapping,
10691085
.input_configured = magicmouse_input_configured,
1086+
#ifdef CONFIG_PM
1087+
.reset_resume = magicmouse_reset_resume,
1088+
#endif
10701089
};
10711090
module_hid_driver(magicmouse_driver);
10721091

0 commit comments

Comments
 (0)