HID: magicmouse: re-enable multitouch after reset-resume
Subsystems (2)
PATCH 1/1 HID: magicmouse: re-enable multitouch after reset-resume
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.
--- drivers/hid/hid-magicmouse.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/hid/hid-magicmouse.c +19 -0
@@ -995,6 +995,22 @@ static void magicmouse_remove(struct hid_device *hdev)hid_hw_stop (hdev); } +#ifdef CONFIG_PM +static int magicmouse_reset_resume (struct hid_device *hdev) +{ +struct magicmouse_sc *msc =hid_get_drvdata (hdev); + +/* The device drops out of multitouch mode on resume; re-send the +* enable report. Only the HID_TYPE_USBMOUSE interface accepts it, and +* it must be deferred. Sending it inline here is too early. +*/ +if (msc && hdev->type ==HID_TYPE_USBMOUSE ) +schedule_delayed_work (&msc->work,msecs_to_jiffies (500 )); + +return 0 ; +} +#endif +static const __u8 *magicmouse_report_fixup (struct hid_device *hdev,__u8 *rdesc,unsigned int *rsize) {
@@ -1058,6 +1074,9 @@ static struct hid_driver magicmouse_driver = { .event = magicmouse_event, .input_mapping = magicmouse_input_mapping, .input_configured = magicmouse_input_configured, +#ifdef CONFIG_PM + .reset_resume = magicmouse_reset_resume, +#endif };module_hid_driver (magicmouse_driver);
Signature · 1 line
2.55.0
Quoted 7 lines · Christopher Kodama
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
0x02on itsHID_TYPE_USBMOUSEinterface, 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.
Quoted 8 lines
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 87a2f10395c8 ("HID: magicmouse: Apple Magic Trackpad 2 USB-C driver support")Assisted-by Claude-Code:claude-opus-4-8Signed-off-by Christopher Kodama <[email protected]>
Applied, thanks.
Signature · 2 lines
Jiri Kosina SUSE Labs