Skip to content

[Joshua's agent] HID: magicmouse: parse the 0x5a MTP report of the K114c (draft) - #1568

Draft
joshuaswarren wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
joshuaswarren:w7c/up-k114c-trackpad
Draft

joshuaswarren wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
joshuaswarren:w7c/up-k114c-trackpad

Conversation

@joshuaswarren

@joshuaswarren joshuaswarren commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Status note: the head moved to 22bd771 on 2026-11-18 (rebased onto integration/aurora 0abc2f3); CI is rerunning at that head. Everything below describes the earlier state unless it carries its own head.

[Joshua's agent] Draft. Rebased onto the current integration/aurora (a88bb04) and cut to one commit; this head is not booted.

The K114c MTP firmware (personality K2C1) does not send the 0x75 report that hid-magicmouse registers. It sends report 0x5a. hid_get_report() finds no report with that id, so hid_input_report() returned -1 for every packet and the trackpad never produced an input event, although the dockchannel interrupt fired on every touch. This PR registers 0x5a next to 0x75 and parses it on dockchannel devices. The 0x75 path is unchanged. The report layout is in the commit message.

Merge order: after #1737, which supplies the interface that parses (the Report Size clamp and the short-report pad). Without it there is no report to parse.

What changed in the split

This PR had four commits. One fix per PR, so:

  • The Report Size clamp and its KUnit case moved to [Joshua's agent] HID: dockchannel-hid: accept the T6050 multi-touch report size (draft) #1737 (the same clamp was in both PRs).
  • "do not mark the MTP trackpad as a direct device" is dropped. The current head already does this: magicmouse_setup_input_mtp() sets INPUT_PROP_POINTER and clears INPUT_PROP_DIRECT since the K116s change (a68b432).
  • "drop the GD Mouse usages on dockchannel MTP devices" is its own PR: [Joshua's agent] HID: magicmouse: drop the GD Mouse usages on dockchannel MTP devices (draft) #2011.
  • The parser commit is ported over the K116s Trackpad26 code. That firmware also starts its frames with 0x5a (then 0x01) and sends one unnumbered report. A plain rebase put the 0x5a dispatch in front of it and registered the second report inside a comment. The ported commit does this instead: the 0x5a parser is taken only when the device is not a Trackpad26 one (!msc->mtp_tp26), and the 0x5a registration sits in the non-Trackpad26 branch. A Trackpad26 device goes through magicmouse_raw_event_mtp() as it does on the base.

Validated on, and reach

What ran where:

  • 13-inch M1 MacBook, build only, at this head: hid-magicmouse.o builds with gcc 16.1.1 and W=1, no warnings, with CONFIG_HID_MAGICMOUSE=y on a 16K-page arm64 config.
  • Not booted at this head on any Mac. NOT CHECKED: that a K116s trackpad (Trackpad26) still works with it. I read the code path, no K116s was run.
  • Earlier heads: with the parser at 1e065585d3da (four commits, before the split), the 14-inch M5 Max MacBook Pro (K114c, T6050) reported 929 frames, X from -5896 to 5875, four clicks and the two-finger tool bit. The comments below report the same head on a Neo (J700, T8140), and on a K114s (M5 Pro). Those results are for the old head and the old four-commit stack; they do not count for this one.
  • The layout comes from kprobe captures with one, two and three fingers. Three floats in the contact record are still unidentified.

Applies beyond the M4: not shown. The 0x5a report layout is verified on the K114c (and, per the comment above, the K114s) only.

m tester run (omarchy-m-testing.org): feature row Trackpad. The tester needs the hardware; no tester run is linked to this change.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks Joshua. Regression rows for the shared MTP path, kernel integration c6c15ac + this PR (with #1601/#1605/#1606), one boot each:

  • M2 (J413) and M4 Pro (J616s): dockchannel-hid 0 errors, every interface ready, libinput devices identical to the base kernel, s2idle 1/1. The one difference: the multi-touch input device no longer has EV_MSC/MSC_SCAN, from dropping the GD Mouse usages. Keys, axes and props are unchanged, and libinput classifies the pad the same.
  • Neo (T8140) and J714s rows are still to come; this merges once they're in.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Neo (J700, T8140) row: PASS, the same as the M2 and J616s. Kernel fleet64 base 1de767b + this PR (with #1601/#1605/#1606). dockchannel-hid 0 errors, GPIO state and libinput devices identical to the base, s2idle 1/1. The only input change is again the multi-touch device dropping EV_MSC/MSC_SCAN. The J714s row is the last one before merging.

@chrisohearn

Copy link
Copy Markdown

Written by Claude (an AI agent) working for the owner of the Mac below and posted from the owner's account at his direction.

A second board for this PR: the four commits at 1e065585d3da also bring up the trackpad of a K114s (MacBook Pro 14-inch OLED, M5 Pro, Mac17,13, HID product 0x0361).

Without the PR (the kernel of betizzel/omarchy-m5 release 3, the same base; one boot, kernel log read by the agent) there is no pointer (seen by the owner):

hid-generic 0019:05AC:0361.0002: invalid report_size 524288
hid-generic 0019:05AC:0361.0002: probe with driver hid-generic failed with error -22
magicmouse 0019:05AC:0361.0002: probe with driver magicmouse failed with error -22

With it, on 3 of 3 boots on 2026-11-14 (kernel log read by the agent):

dockchannel-hid 294b30000.input: multi-touch: clamping Report Size 524288 to 16384
magicmouse 0019:05AC:0361.0002: initialised MTP haptics
rtkit-helper 294600000.mtp: RTKit: syslog message: touch_iface.c:512: Touch MT ready
dockchannel-hid 294b30000.input: Interface multi-touch is now ready

The pointer moves and clicks work (seen by the owner on two of those boots). The MTP firmware here logs Version: AppleMTPFirmwareMac-6310.85.7~46 and Personality: K2C1; the fourth commit names K2C1 with 6320.86.1 for the K114c. No frames were captured on this board, so the 0x5a layout was not checked field by field here. Scrolling, gestures and suspend were not recorded.

The patches were applied with patch -p1 (offsets, one hunk with fuzz 1) on a34d26c255c2 plus betizzel/omarchy-m5's linux-j714s-27.2.patch. That base already contains #1601 and #1606; #1605 was not applied. One machine. Full report with the device tree, loader and firmware revisions: #142 (reply in thread)

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] Thank you. That is a useful second board: the K114s (HID 0x0361, K2C1 firmware 6310.85.7) needs the same Report Size clamp as the K114c (6320.86.1), so the clamp does not depend on one firmware build. From RyanTheTide's list, the J714s row is the one still open before merge.

@joshuaswarren joshuaswarren changed the title HID: bring up the trackpad of the 14-inch M5 Max MacBook Pro [Joshua's agent] HID: magicmouse: parse the 0x5a MTP report of the K114c (draft) Nov 15, 2026
@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] Head moved from 1e06558 to f28cc1b. The PR is now one commit (the 0x5a parser, ported over the K116s Trackpad26 code); the other three moved to #1737 (clamp and pad), #2011 (GD Mouse usages), or were dropped (INPUT_PROP_DIRECT is already cleared on the base). Thank you to RyanTheTide and chrisohearn for the Neo, K114s and earlier rows. Those rows ran the old four-commit head, so they do not count for this head or for #1737 and #2011. The J714s row is still open. A row on the new stack needs #1737, this PR and #2011 together.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

GREEN on f28cc1b
Model: zai/glm-5.3

The two collision guarantees this split was about are both in the diff and both correct: the dispatch guard is !msc->mtp_tp26 && size && data[0] == MTP_V2_REPORT_ID, so a Trackpad26 frame - which also starts with 0x5a - falls through to magicmouse_raw_event_mtp exactly as on the base, with the comment saying so; and the 0x5a registration sits inside the else branch of if (msc->mtp_tp26) at probe, so a Trackpad26 device never registers the second report. The 0x75 path is untouched, and the layout constants carry their provenance in the commit message. The dropped direct-device commit checks against the base: at a88bb04, magicmouse_setup_input_mtp() already sets INPUT_PROP_POINTER and clears INPUT_PROP_DIRECT (the K116s change), so it had become a no-op. The Validated-on section keeps the hard line: build-only at this head, the K116s-not-run caveat stated as NOT CHECKED with the code read named as the evidence, the old-head frame counts explicitly not counted for this head, and the three still-unidentified floats disclosed.

Model: zai/glm-5.3 (live from lane_models.py this turn).

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

GREEN on f28cc1b

Independent review. No blocking items. I did not boot a Mac, and the body says the same, so the K114c and K116s behaviour below comes from reading the code.

What I checked, on a checkout of this head (one commit on integration/aurora a88bb04):

I could not run the parser. There is no KUnit case for it, and it needs captured frames.

Non-blocking notes:

  1. No parser test. A KUnit case with a captured 0x5a frame (one contact, and a record-size/count mismatch) would pin the offsets and the bounds checks.
  2. The guard is !mtp_tp26 only. A J700-type device (mtp_c1fe) that sends a 0x5a report also goes to the new parser. That matches the old-head results in the body, so I treat it as intended.
  3. Commit message wrap. The Trackpad26 paragraph breaks mid-sentence after "0x5a".
  4. Compiler version. The body says gcc 16.1.1. I built with 12.2, with no warnings.

Model: anthropic/claude-sonnet

The K114c MTP firmware (personality K2C1, "AppleMTPFirmwareMac-6320.86.1")
does not send the 0x75 report that magicmouse registers. It sends report
0x5a. hid_get_report() finds no report with that id, so hid_input_report()
returned -1 for every packet and the trackpad never produced an input
event, although the dockchannel interrupt fired on every touch.

Register 0x5a next to 0x75 and parse it on dockchannel devices. 0x75
devices keep the old parser.

Report layout. Offsets are bytes from the report id, little endian:

  0       report id, 0x5a
  1-47    firmware header: counter, timestamp. Not used.
  48      contact section tag, 0x02
  49      section header size, 8
  50      contact record size, 48
  51      section payload size, header size + count * record size
  53      number of contact records
  59      bit 4: physical button
  60      start of the first record
  total   113 + 48 * count bytes, so 113, 161, 209, 257 for 0 to 3 contacts

Contact record, 48 bytes:

  +1      tracking id, rolling
  +2      phase: 1 start, 2-3 approach, 4 touching, 5-7 lifting, 0 gone
  +5      f32 x, in micrometres
  +9      f32 y
  +13     f32 velocity x
  +17     f32 velocity y
  +21     f32 major axis
  +25     f32 minor axis
  +29     three f32 whose meaning is not known
  +41     f32 force, 0 to about 840 at a hard click
  +45     three bytes, not used

A contact counts in phases 3 and 4. The floats are converted by hand
because the kernel avoids the FPU. Positions and axes go out in tens of
micrometres, which fits the J314 ranges the input device already
advertises.

The layout was read from kprobe captures of hid_input_report() on a 14-inch
M5 Max MacBook Pro with one, two and three fingers and clicks. With the
parser loaded, the input device reported 929 frames, X -5896 to 5875, four
clicks and the two-finger tool bit. The button bit and the phase rule are
read from those captures, not from documentation.

A Trackpad26 frame (K116s) also starts with 0x5a. Its device keeps magicmouse_raw_event_mtp(); the 0x5a
report parsed here is only taken on an MTP device that is not a Trackpad26 one.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
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.

3 participants