Skip to content

HID: apple-mtp-haptic: return the actuator to device mode on resume - #2100

Closed
mouthmantra wants to merge 1 commit into
aurora-silicon:mainfrom
mouthmantra:j614c-trackpad-resume
Closed

mouthmantra wants to merge 1 commit into
aurora-silicon:mainfrom
mouthmantra:j614c-trackpad-resume

Conversation

@mouthmantra

@mouthmantra mouthmantra commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Since "HID: dockchannel: notify HID drivers across system sleep",
magicmouse forgets a host-controlled actuator mode on every resume,
on the grounds that system sleep hands the actuator back to its
firmware. Suspend-to-idle does not: DockChannel only sends the MTP its
sleep reports when the suspend goes through firmware, so an actuator
that userspace force-feedback took host-controlled before suspend is
still host-controlled after it.

The cache and the hardware then disagree. magicmouse believes the
firmware reports the button, while the host-controlled firmware
reports none, so on a J614c (MacBook Pro 14", M4 Max) the trackpad
stops clicking after a suspend and resume. Tap-to-click and dragging
still work. Unbinding and binding hid-apple-mtp-haptic restores
clicks, because probe sends report 0x21 with device-controlled mode.

Do the same on resume, before the click strength is checked, so the
actuator matches what its users now assume. A user that still wants
host control takes it again on its next effect. Update the magicmouse
comment that said nothing on the host returns the actuator.

Tested on J614c with s2idle: the pad clicks after resume with
userspace haptic effects loaded before suspend.

https://claude.ai/code/session_01D5ybhDsuN7WkfTfz4jRcwj

Since "HID: dockchannel: notify HID drivers across system sleep",
magicmouse forgets a host-controlled actuator mode on every resume,
on the grounds that system sleep hands the actuator back to its
firmware. Suspend-to-idle does not: DockChannel only sends the MTP its
sleep reports when the suspend goes through firmware, so an actuator
that userspace force-feedback took host-controlled before suspend is
still host-controlled after it.

The cache and the hardware then disagree. magicmouse believes the
firmware reports the button, while the host-controlled firmware
reports none, so on a J614c (MacBook Pro 14", M4 Max) the trackpad
stops clicking after a suspend and resume. Tap-to-click and dragging
still work. Unbinding and binding hid-apple-mtp-haptic restores
clicks, because probe sends report 0x21 with device-controlled mode.

Do the same on resume, before the click strength is checked, so the
actuator matches what its users now assume. A user that still wants
host control takes it again on its next effect. Update the magicmouse
comment that said nothing on the host returns the actuator.

Tested on J614c with s2idle: the pad clicks after resume with
userspace haptic effects loaded before suspend.

Signed-off-by: Logan Torres <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01D5ybhDsuN7WkfTfz4jRcwj
@Isaac-Duarte

Copy link
Copy Markdown
Contributor

This conflicts with #2026. On J714s, multi-touch (DockChannel interface 1) resumes before the actuator (interface 4), so this switch runs after #2026's resume has asserted host mode. magicmouse then caches host mode while the firmware is in device mode, and with haptic_press=Y each press clicks twice.

#2026 restores the wanted mode from the trackpad side: host mode when haptic_press is set or effects are loaded, device mode otherwise. That covers the J614c case here, since loaded effects keep the button derived on the host after resume (from the code and #2026's loaded-effects harness case; not tested on a J614c). If #2026 lands, this switch should go. Raised in review: #2026 (comment)

@DjDeveloperr

Copy link
Copy Markdown
Contributor

#2026 is merged into integration/aurora (493b6dc). Its trackpad-side resume now asserts the wanted actuator mode: host mode when haptic_press is set or effects are loaded, device mode otherwise.

With that in, apple_actuator_resume() switching the actuator to device mode undoes it on DockChannel machines. The actuator interface resumes after the trackpad, so magicmouse keeps host mode cached while the firmware is in device mode, and every press clicks twice with haptic_press=Y. The two PRs also edit the same comment block.

Please drop the actuator-side switch and rebase onto the current integration/aurora. If something on the J614c is still not covered by #2026's resume path, could you describe it here?

@RyanTheTide

Copy link
Copy Markdown
Contributor

Blockers: 1.

  1. Besides the conflict with HID: magicmouse: keep host click feedback across system sleep #2026 already raised here, the commit carries a Co-Authored-By: Claude ... trailer and a Claude-Session: link. If anything from this commit survives the rebase, drop both trailers and keep only your Signed-off-by. The PR body should end with Assisted-by: LLM (<Vendor>:<Model>) instead of "Generated with Claude Code" and the session link.

HW row: if a J614c-specific gap remains after #2026: J614c on current integration/aurora, s2idle with userspace haptic effects loaded, then with haptic_press both off and on: physical click works after resume and each press clicks once; 0 AVC / 0 failed units / 0 new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

@mouthmantra, a tidy-up pass over the open PRs here. These of yours need something:

If any of these are no longer needed, closing them helps; otherwise a merge or rebase onto integration/aurora is usually all they need. Thanks!

@github-actions github-actions Bot added merge-conflict Conflicts with the base branch (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 24, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: HOLD at c9b5c2b2d943

Blockers:

  • drivers/hid/hid-apple-mtp-haptic.c:210-231 (PM resume ordering regression & superseded by #2026): dockchannel_hid_resume() resumes interfaces in ascending index order (drivers/hid/dockchannel-hid/dockchannel-hid.c:1929-1938), so the multi-touch interface (hid-magicmouse) resumes before the actuator (hid-apple-mtp-haptic). On main, #2026 (493b6dc112e7 / 9e975bf50fdb) already asserts the desired mode in magicmouse_haptic_resume() (HID_HAPTIC_MODE_HOST when haptic_press is enabled or userspace effects are loaded, HID_HAPTIC_MODE_DEVICE otherwise). Switching to device mode unconditionally in apple_actuator_resume() overwrites that state without updating msc->haptics->mode or synchronizing with auto_trigger_mutex (also racing with post-resume haptic work queued once msc->haptic_suspended clears), causing double clicks with haptic_press=Y and breaking host-controlled FF state across DockChannel MTP Macs. Drop the actuator-side mode switch and close this PR as superseded by #2026 unless a concrete J614c gap still reproduces on current main.
  • drivers/hid/hid-magicmouse.c:2058-2066 (merge conflict): conflicts with main (mergeable: CONFLICTING, DIRTY), where #2026 replaced magicmouse_haptic_forget_mode() with magicmouse_haptic_resume(). Rebase onto current main if any remaining J614c fix is needed.
  • §4 (attribution): commit c9b5c2b2d943 carries tool co-author and session-link trailers, and the PR body includes a tool-generated footer and session link. Strip all tool and session attribution from the commit message and PR body, keeping only the human author and human Signed-off-by: (do not add any tool-assistance trailer either; current §4 requires zero tool attribution everywhere).
  • §5 (PR structure & exact-head evidence): PR body is missing the required What:, Tested:, Risk:, and Not yet: lines and an exact-head regression row (0 SELinux denials, 0 failed units, 0 new kernel errors) covering J614c (with userspace effects loaded, and haptic_press both off and on) plus multi-Mac DockChannel verification on current main.

Checked: Diff against main (677be395b9d2), PM resume ordering in dockchannel-hid.c / spi-hid-apple-core.c / hid-magicmouse.c, commit & PR hygiene (§1–§6), CI (host-tests passed on stale pre-conflict base; PR is CONFLICTING), and HW evidence rows.

Evidence
  • §1 (No model gating / multi-Mac non-regression): FAIL — no chip/board/firmware gates added, but forcing device mode in apple_actuator_resume() regresses DockChannel MTP Macs running haptic_press=Y or userspace FF effects after #2026 (493b6dc112e7) because dockchannel_hid_resume() resumes interface 1 (multitouch) before interface 4 (actuator).
  • §2 (Production-ready, no hacks): FAIL — unsynchronized mode write in apple_actuator_resume() bypasses hid-magicmouse's msc->haptics->auto_trigger_mutex and cached msc->haptics->mode after magicmouse_haptic_resume() has already cleared msc->haptic_suspended. (No cmdline/module params or sleeps added.)
  • §3 (Safety): PASS — no hardcoded safety limits or firmware/speaker/USB-C safety issues.
  • §4 (IP & attribution): FAIL — no Apple copyrighted material, human Signed-off-by: is present, but commit c9b5c2b2d943 has tool co-author and session-link trailers and the PR body has a tool footer and session link.
  • §5 (Evidence & PR structure): FAIL — missing What:/Tested:/Risk:/Not yet: fields, exact head SHA + kernel/build in Tested:, multi-Mac check, and regression row (0 SELinux denials, 0 failed units, 0 new kernel errors).
  • §6 (Naming): PASS — no prohibited naming issues.
  • Commits: 1 commit (c9b5c2b2d943d3b1184240703ab75a7e8f743dcf), conflicting against main (677be395b9d2).
  • CI: host-tests (Host tests, run 43942500557) SUCCESS on 2026-11-21 against the pre-conflict base; PR is currently CONFLICTING (DIRTY) and needs rebase/re-test if kept open.
  • Non-blocking note: If J614c s2idle with loaded userspace haptic effects works on current main with #2026 merged (magicmouse_haptic_resume() asserts HID_HAPTIC_MODE_HOST while effects are loaded and HID_HAPTIC_MODE_DEVICE once erased), this PR can simply be closed as superseded.

@github-actions github-actions Bot added changes-requested A reviewer requested changes (bot) merge-conflict Conflicts with the base branch (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Nov 24, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor

#2026 is in main, and it sets the actuator mode on resume, so this change would now undo it. If the J614c still misbehaves on current main, what's left is a rebase and a run showing the problem; otherwise this can be closed as superseded by #2026.

@github-actions

Copy link
Copy Markdown

Merge readiness at c9b5c2b2: not ready yet

Check Detail
CI at head ok 1 check passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes no requested by DjDeveloperr
Hardware row at head no no line with the head SHA c9b5c2b2, a Mac and a result in the PR body or a comment
Conflicts no merge conflicts with main: merge it in (no force push)
PR text adopt when you next edit add a 'Tested:' line; a 'Risk:' line (door and Macs) (guide)

Areas: none matched in CODEOWNERS

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Superseded by #2026 (merged on main as 493b6dc), which sets the wanted actuator mode on trackpad resume; per the review findings on this PR, switching to device mode in apple_actuator_resume() now conflicts with #2026. Reopen with a rebased repro if J614c still fails on current main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changes-requested A reviewer requested changes (bot) merge-conflict Conflicts with the base branch (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants