Skip to content

HID: magicmouse: hold the multitouch enable work across system sleep - #1317

Merged
RyanTheTide merged 2 commits into
integration/aurorafrom
hid/magicmouse-mt-work-across-sleep
Nov 9, 2026
Merged

RyanTheTide merged 2 commits into
integration/aurorafrom
hid/magicmouse-mt-work-across-sleep

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

reset_resume re-arms the trackpad's multitouch-enable work 500 ms after resume. When the next suspend starts inside that window, the work is still pending. Its timer then fires during the next suspend or resume, before the SPI HID transport has power, and the feature report fails with -ENODEV:

magicmouse 001C:05AC:0343.0002: unable to request touch data (-19)

After that resume the touch mode is not restored. The fix cancels the work in .suspend. reset_resume re-arms it as before, and a plain resume (when the device kept its state) re-queues it only if suspend stopped it while it was pending.

Tests

  • checkpatch.pl --strict: 0/0/0 on both commits.
  • Host model tools/asahi/mtp-pm-tests.py now runs the production magicmouse_suspend() from the transport's suspend notification. Pending enable work is cancelled at suspend and queued exactly once on resume, and idle work stays idle. Making resume skip the re-queue fails the model. The old-transport negative control still fails as expected.
  • J316s (M1 Pro). Test kernel: this patch on integration f4b6890 plus rtc/spmi/dts: t600x PMU RTC wake alarm #1312 (RTC wake) and a lab-only watchdog-in-suspend patch. A kretprobe on magicmouse_enable_multitouch counts every enable report and its return value.
run without this patch with this patch
back-to-back rtcwake -m freeze (no gap) 2 of 3 resumes logged unable to request touch data (-19) (two regression-suite runs) 10/10 sleeps ok, 0 errors; 1 enable report after the final resume, accepted
3 sleeps with 2 s gaps 3 enable reports, all accepted, 0 kernel errors
evtest on "Apple SPI Trackpad" after the run opens; BTN_TOUCH, ABS_MT_POSITION_X and ABS_MT_TRACKING_ID present

🤖 Generated with Claude Code

reset_resume re-arms the work that puts the trackpad back into
multitouch mode 500 ms after resume. When the next suspend starts
within that window, the work is still pending: its timer fires during
the following suspend or resume, before the SPI HID transport is
powered again, and the feature report fails with -ENODEV ("unable to
request touch data (-19)"). The touch mode is then not restored after
that resume.

Cancel the work in suspend. reset_resume schedules it again as before;
a plain resume, where the device kept its state, re-queues it only if
suspend stopped it while it was pending.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The MTP PM model now runs the production magicmouse_suspend() from the
transport's suspend notification. It checks that pending multitouch
enable work is cancelled at suspend and queued once on resume, and that
idle work stays idle.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide merged commit bfb3f99 into integration/aurora Nov 9, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the hid/magicmouse-mt-work-across-sleep branch November 9, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant