Skip to content

HID: magicmouse: report the force click as KEY_INFO by default - #3039

Open
RyanTheTide wants to merge 2 commits into
mainfrom
userpath/force-click-key
Open

RyanTheTide wants to merge 2 commits into
mainfrom
userpath/force-click-key

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 24, 2026 •

Copy link
Copy Markdown

Problem. A force click (the second, firmer stage of a Force Touch click) does nothing on the desktop. On macOS it opens Quick Look on the item under the pointer. The driver already detects the deep stage and plays its haptic (Ryan: both click levels work on the J615), and it can hold a key on a separate " Force Click" input device. It only does so if haptic_deep_keycode names a key, and nothing names one, so userspace never sees a force click.

Change. Default haptic_deep_keycode to KEY_INFO. Linux has no force-click key. KEY_INFO (keysym XF86Info) has no default binding on our desktops, so the key is inert until the desktop binds it. The GNOME side, which opens the Files previewer for the clicked item, is a separate userspace change (linked from the lane). haptic_deep_keycode=0 still turns it off.

Testing. J615 (MacBook Air M3), fleet85 plus this change, module swapped live: Apple MTP multi-touch Force Click appears with key 358 (KEY_INFO) in its capability mask, libinput lists it on seat0, and haptic_press is re-applied by the udev rule. The stock module was restored afterwards. The userspace binding was proven separately on the same Mac with KEY_INFO injected through uinput: with the extension the previewer opens on the selected file, without it nothing happens.

Still to run. A real force click by a person on this kernel with the extension installed. A J713 or J413 device row (any MTP pad) and an M1 SPI pad row (the J316s), both at the PR head.

Scope

The key comes from the existing host-derived deep click. That covers every internal trackpad with an actuator: the MTP pads (M2 and later) and the SPI pads (M1 generation), whose raw events go through the same MTP click path. (The first commit's message says the SPI pads have no deep-click detection yet. That is wrong, and it stays in history because we do not force push.)

A second commit creates the Force Click device only after the FF device exists, so a failed input_ff_create() leaves no orphaned Force Click device.

The host already tells a deep click (the second, firmer stage of a Force
Touch click) from an ordinary one and plays its haptic, but reports it
to userspace only if haptic_deep_keycode names a key, and nothing names
one. So a force click does nothing on the desktop, where macOS opens
Quick Look on the item under the pointer.

Default the key to KEY_INFO. Linux has no force-click key; KEY_INFO
(keysym XF86Info) has no default binding on the desktops we ship, so the
key is inert until the desktop binds it to what a force click does there
(in GNOME Files: the preview of the item clicked). It stays on the
separate "<trackpad> Force Click" input device, held for as long as the
deep stage lasts; haptic_deep_keycode=0 still turns it off.

This applies to every trackpad with host-derived clicks (the MTP pads
with an actuator); the SPI pads have no deep-click detection yet.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Formal adversarial §1–§6 pre-PR review at live head 3c9f4c80e609197a28170b0be6ab5b37759c0f84 (checked against live integration/aurora 5746ef8a5afd).

Checklist Audit (§1–§4, §6)

  • §1 No model gating: Pass. Uses existing driver capability/path without chip/board/firmware gates.
  • §2 Production-ready / Code review (drivers/hid/hid-magicmouse.c):
    • Changing haptic_deep_keycode from 0 to KEY_INFO activates magicmouse_setup_force_input() and magicmouse_force_key() by default on every internal Apple trackpad with haptics.
    • Factual discrepancy in commit message / PR body (SPI trackpads): Both state "the SPI pads have no deep-click detection yet", but in live drivers/hid/hid-magicmouse.c, magicmouse_init_haptics() runs for both BUS_HOST and BUS_SPI (lines 2785–2786), registers "<name> Force Click" with KEY_INFO on SPI trackpads too (line 2732), and magicmouse_raw_event_spi() (line 1494) delegates directly to magicmouse_raw_event_mtp() -> magicmouse_haptic_click() -> magicmouse_force_key() (with haptic_deep_threshold comments even calibrated from J313 at line 119). Please correct the scope description (or clarify/test SPI behavior).
    • Non-blocking error-path note (apple_taptic_init_mtp, lines 2731–2751): magicmouse_setup_force_input(msc) runs before input_ff_create(). If input_ff_create() fails, msc->haptics remains NULL, leaving an orphaned devm-managed "Force Click" input device registered until unbind. Calling magicmouse_setup_force_input(msc) after input_ff_create() succeeds avoids that.
  • §3 Safety: Pass.
  • §4 Clean-room & Attribution: Pass. Single commit 3c9f4c80e609 has human author/committer (Ryan Murray <ryan@aurorasilicon.org>) and human Signed-off-by: only; zero AI commit trailers; Assisted-by: disclosed in PR body.
  • §6 Naming & CI: Pass. Clean naming; CI host-tests is SUCCESS.

Blockers (§5)

  1. No full boot on exact head 3c9f4c80e609 and no default-cmdline regression tuple: Testing only live-swapped the module onto an unrelated fleet85 kernel and reverted it, without reporting kernel/build ID, 0 AVC denials, 0 failed units, and 0 new kernel errors on a clean default-cmdline boot of 3c9f4c80e609.
  2. Feature event not exercised on hardware: Only capability-mask exposure was checked; an actual deep-click press/release emitting KEY_INFO (and verifying no stuck key across release / suspend-resume) has not yet been run on this kernel (listed under Still to run).
  3. No regression Mac for shared driver: hid-magicmouse.c is shared across all internal MTP (M2–M5) and SPI (M1) trackpads plus external Magic Mouse/Trackpad devices. Please include at least a second Mac regression row (e.g., J713/J413 MTP and/or an M1 SPI trackpad, since SPI also registers the new Force Click input device).

Assisted-by: LLM (Gemini 4 Neon)

magicmouse_setup_force_input() ran before input_ff_create(). When
input_ff_create() failed, the trackpad was left without haptics but
with a registered "<trackpad> Force Click" input device that could
never send anything, until the driver was unbound.

Set the Force Click device up only once the FF device exists.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

RyanTheTide commented Nov 24, 2026 •

Copy link
Copy Markdown
Author

Thanks. At 1f03387: (1) the PR body now has the scope right: the SPI pads (M1) take the same deep-click path and get the Force Click device too. The first commit's message is wrong on that point and stays as is, since we do not force push. (2) The non-blocking error path is fixed in 1f03387: the Force Click device is created only after input_ff_create() succeeds. Build check: hid-magicmouse.o, arm64, clang 22, fleet85 config, W=1, no warnings; checkpatch clean. (3) The rows are still owed (default-cmdline boot at the head, a real deep click with press/release and suspend, a J713/J413 MTP row and a J316s SPI row). MERGETRAIN6 has them queued in HWROWS.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Formal §1–§6 re-review at live head 1f033871260a9878d42903b1e6674495d85a2aee (against integration/aurora 5746ef8a5afd, MERGEABLE/CLEAN, CI 1/1 SUCCESS: Host tests / host-tests), following up on #6033464171.

Resolution of Earlier Findings

  1. SPI trackpad scope discrepancy: Resolved in the PR body (<details><summary>Scope</summary>) and PR comment, which now accurately document that M1 SPI trackpads share the deep-click path and also register the "Force Click" device. (Acknowledged that commit 3c9f4c80e6's message retains the earlier wording to avoid force-pushing.)
  2. Error-path ordering in apple_taptic_init_mtp(): Cleanly fixed in 1f03387126 — magicmouse_setup_force_input(msc) now runs strictly after input_ff_create() succeeds, avoiding an orphaned "Force Click" input device on FF init failure.

Current §1–§6 Status

  • §1–§4, §6 & CI: All pass cleanly. Both commits (3c9f4c80e609, 1f033871260a) have human author/committer (Ryan Murray <ryan@aurorasilicon.org>) and human Signed-off-by: only, zero AI commit trailers, Assisted-by: in PR body, and green CI (Host tests / host-tests: SUCCESS).
  • §5 Evidence (still owed before APPROVE): Keeping prior CHANGES_REQUESTED in place and posting COMMENT here since code/CI/policy are now 100% clean and only the queued exact-head (1f033871260a) hardware rows remain:
    1. Clean default-cmdline boot at exact head 1f033871260a with full §5 regression tuple (0 SELinux denials, 0 failed units, 0 new kernel errors).
    2. Real physical deep-click press/release emitting KEY_INFO (verifying no stuck key across release and suspend/resume).
    3. Cross-Mac regression rows on a second MTP pad (J713/J413) and an M1 SPI pad (J316s).

Once those rows are posted, this is ready to convert to APPROVE.

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide

RyanTheTide commented Nov 24, 2026 •

Copy link
Copy Markdown
Author

Exact-head rows at 1f033871260a (kernel 7.3.0-aurora-fc3039: this branch with the fleet85 release config). Each Mac booted it once as a non-default entry on its production cmdline, then went back to its production kernel. No Stage 1 or Stage 2 change.

Mac trackpad Enforcing / AVC / failed units / Oops kernel errors vs the production boot Force Click device 15 s s2idle
J713 (M4 Air) MTP yes / 0 / 0 / 0 9 vs 2, all from drivers this PR does not touch (see below) Apple MTP multi-touch Force Click, KEY_INFO (358), on seat0 in libinput suspend entry/exit, KEY_INFO released before and after, 0 Oops
J615 (M3 Air) MTP yes / 0 / 0 / 0 12 vs 13, same lines same, 358 same
M1 Pro (J316s) SPI yes / 0 / 0 / 0 0 vs 0 Apple SPI Trackpad Force Click, 358 same

This also confirms the SPI scope: the M1 SPI pad registers its Force Click device the same way.

Still owed: a real deep click by a person. Press and release on a real finger needs Ryan; the stuck-key check above is the key state before and after suspend, with no press.

Details
  • J713's extra error lines are 3x apple-dcp no IOMMU domain; not handing the firmware untranslated DMA addresses, 3x dwc3-apple USB3 PHY setup failed, err=-95, sn201202x cable revalidation failed after 3 attempts and 2x thermal_zone1. They come from integration/aurora commits since the fleet85 cut (e.g. the DCP DART work of drm/apple: dcp: keep the display DART dark while DPMS has its domains off #2962), not from hid-magicmouse. The internal panel stayed connected and the GNOME session came up.
  • Key state is read with EVIOCGKEY on the Force Click event node. s2idle is rtcwake -m freeze -s 15 on the wake-capable RTC.
  • The haptic_deep_keycode parameter reads 358 by default; nothing was set on the cmdline.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Formal §1–§6 review at live head 1f033871260a9878d42903b1e6674495d85a2aee, after the exact-head rows posted at 06:04Z. Nothing has been pushed since my 04:21Z COMMENT.

Verdict: COMMENT. Code, CI and policy are clean. Two of the three §5 items I asked for are now covered. One is still owed, so this doesn't approve yet.

§5 rows at 1f033871260a (kernel 7.3.0-aurora-fc3039)

  • Accepted: default-cmdline boot and the regression tuple. J713 (M4 Air, MTP), J615 (M3 Air, MTP) and J316s (M1 Pro, SPI) each booted the head once on their production cmdline. Each shows Enforcing, 0 AVC, 0 failed units and 0 Oops. haptic_deep_keycode reads 358 with nothing set on the cmdline.
  • Accepted: cross-Mac rows. A second MTP Mac (J713) and an M1 SPI Mac (J316s) both register their Force Click device with KEY_INFO (358). This also confirms the SPI scope in the PR body. On all three Macs, a 15 s s2idle shows KEY_INFO released before and after suspend (EVIOCGKEY), with 0 Oops.
  • Note (not blocking): J713 kernel errors, 9 vs 2. The extra lines come from apple-dcp no IOMMU domain, dwc3-apple USB3 PHY setup failed, err=-95, sn201202x cable revalidation and thermal_zone1. None of these is hid-magicmouse, so I accept that they don't come from this PR. Still, the baseline is the fleet85 kernel, not integration/aurora without this PR. That makes these errors a possible integration/aurora regression on J713, which should be followed up on its own (for example, against the #2962 DCP DART work).

Still owed

  1. A real deep click by a person on this kernel. Press and release on the pad, with KEY_INFO going down on the deep stage and up on release, and no stuck key after release. The PR body and your 06:04Z comment both list this as owed. It is the one event this default change turns on for every Mac with a haptic trackpad, and the rows so far only check the device, its capabilities and the idle key state.

§1–§6

  • §1 Pass: no chip/board/firmware gates, and it runs on the existing haptic path for MTP and SPI.
  • §2 Pass: no new parameters are needed. haptic_deep_keycode=0 still turns the key off. The Force Click device is now set up only after input_ff_create() succeeds.
  • §3 Pass.
  • §4 Pass: both commits have a human author and committer (Ryan Murray) and a human Signed-off-by: only. Assisted-by: is in the PR body.
  • §5 Open: only item 1 above.
  • §6 Pass.
  • CI: 1/1 Host tests / host-tests SUCCESS. MERGEABLE/CLEAN against integration/aurora.

Once the real-press row is posted, this converts to APPROVE.

Assisted-by: LLM (Claude Opus 5.5)

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.

2 participants