Skip to content

HID: apple-mtp-kiwi: keep a dropped hold suppressed across its whole blob - #2159

Closed
joshuaswarren wants to merge 3 commits into
aurora-silicon:integration/aurorafrom
joshuaswarren:w7H/kiwi-harden-aurora
Closed

joshuaswarren wants to merge 3 commits into
aurora-silicon:integration/aurorafrom
joshuaswarren:w7H/kiwi-harden-aurora

Conversation

@joshuaswarren

Copy link
Copy Markdown
Contributor

[Joshua's agent] HID: apple-mtp-kiwi: keep a dropped hold suppressed across its whole blob

On the M5 Max MacBook Pro touch screen, a held, still contact that the driver
had correctly dropped came back as phantom touches from the far edge of the
same blob one frame later.

The suppression map was a box on the centroid: on the always-lit capture the
centroid sits on the blob's corner. The drop now marks that box and every
still-lit cell that touches it, out to 6 cells. The region stays dead until 240
consecutive quiet frames; the single-cell guard does not clear while the map is
holding. The reach-0 mutation (second commit) proves the grow is load-bearing:
Honest state: the module on the M5 is sha256
65147e918894395c2bb5d4da87e0583d86d450f46472e853022f5dc09b31c605,
vermagic 7.3.0-k114c-ARCH-a3m, built from this exact source and reproduced
byte-for-byte by a second, independent build. (An earlier local build, 97b74c79,
lacked the annotated kernel tag and carries a vermagic plus; it is NOT what is
on the machine.) Loaded by hand on Nov 17 2026 at 7:46 AM CST, tested by finger
at 8:40 AM: six contacts, zero phantom touches, a 3.12-second still press
reported as one contact, and a 30-minute run with zero events (7:46:28 to
8:16:48 AM). Load at boot is blocked by our own local blocklist file
/etc/modprobe.d/m5-touch-off.conf (Nov 16, from the phantom-touch days); it is
being removed, restart check to follow. Draft until load at boot is confirmed.
Replay suite and mutations run on the host only (userspace harness in
drivers/hid/apple-mtp-kiwi-replay); never booted as an in-tree build.

Range: e26025ad (driver fix) + 95769b1 (reach-0 mutant in the suite),
cherry-picked with -x onto aurora main; driver byte-identical to the reviewed
head (sha256 3048da17af6fdcc15a82bd58bb933a61225761b9dc846742fb269b0df6208c97).

Why: the suppression map was a box on the centroid. On the original
always-lit capture the centroid sits on the blob's corner, so the far
edge stays unmarked and re-arms one frame after the drop (borns 5985
and 5995). The drop itself is correct: the first contact ends at
born+5399.

What: the drop marks that box and then every still-lit cell that
touches it, out to 6 cells. The region stays dead until 240 consecutive
frames below the release level. A short dip does not clear it, and the
single-cell guard does not clear while the map is holding. A real lift
still frees the cells.

Proof: holdrebirth, the original 8000-frame always-lit capture, is red
at 3c5c18e0 (4 contacts, borns 583, 594, 5985, 5995) and green here
(exactly 583 and 594). breatheretap stays 2 contacts, both bounded.
lifteretap is a lift, a quiet run, and a new touch on the same cells
(borns 189 and 1074). A reach-0 mutant of the grow goes red again.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
(cherry picked from commit e26025adb80fffb7c3b0f5ca15f12bd65e3fd357)
Why: the hold-rebirth fix lives or dies with the blob grow; a mutant
that drops it must go red on holdrebirth, and does (the old 4 borns).
Also generates the holdrebirth capture for that check.

Proof: full mutation run: M1, M4, M5, M6 red; M3 idle PASS; M0
unhardened baseline red on stuckedge as before.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
(cherry picked from commit 95769b13c323c8ebe3b8aa9e5bab765dacd2e28c)
@joshuaswarren

Copy link
Copy Markdown
Contributor Author

GREEN on c5725a2
Model: zai/glm-5.3-flash

Checked at the exact fork head 71dae12d50a9 (base 77cb8f2, 2 commits, cherry-pick trailers match e26025ad/95769b1).

Content: GO. The suppression code at the head does what the text says: a drop marks the centroid box (+-2) and then grows ring by ring into still-lit neighbours, clamped at KIWI_SUP_REACH 6 cells, threshold half-lit; the only re-arm clock is KIWI_LIFT_FRAMES 240 quiet frames on the sup_map, and the single-cell guard does not clear while the map holds. The second commit adds only the 57-line mutation runner (run-kiwi-mutations.sh), no driver change. Honest-state lines are complete (out-of-tree build on the M5, sha256 given, finger test, never in-tree booted, justified non-draft).

One finding (CHANGES), blocking as a PR base: the parent 77cb8f2 ("mfd: macsmc: Add second gpio subdevice for 'gp00' keys") is an ancestor of NEITHER aurora-silicon/linux main (1d2904f) NOR fork main (774cf6b70), and upstream main's whole history has zero gp00 / macsmc gpio-keys commits. So a PR opened from this branch carries an invisible base and cannot merge against rule-1 base = current main. Content is ready; rebase the two commits onto current aurora main (the driver has no dependency on gp00 that I can see) and re-push; the PR text needs no other change.

CHANGES on 71dae12d50a9 - single finding: rebase the two commits onto current aurora-silicon/linux main (1d2904f); content itself is GO.
Re-check after the rebase, 09:31 CST: new head c5725a2, parent dcce0e7 is an aurora merge commit (PR #2138) descending from the main I verified (1d2904f); the two commits are byte-identical to the checked head (diff on the driver and replay tree is empty; driver sha256 3048da17af6fdcc1); cherry-pick trailers and the PR text unchanged.
GREEN on c5725a2 (#2159).

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] Load-at-boot answer, 2026-11-17 ~9:47 AM CST: the blocklist file is gone and touch came up by itself on two restarts (9:38 and 9:47 AM), module 65147e91. Marking ready for review.

@joshuaswarren
joshuaswarren marked this pull request as ready for review November 17, 2026 16:06
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-17T16:06:52.521653Z
We couldn’t complete this review. Comment @codex review to try again.
c5725a2 Draft marked ready
🔒 Security Review ❌ Failed 2026-11-17T16:07:00.406632Z
We couldn’t complete this review. Comment @codex security review to try again.
c5725a2 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@chatgpt-codex-connector

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the finger test and the load-at-boot check. The suppression logic is clear, and the reach-0 mutant is good evidence. Before this can merge, three things:

  1. The driver is never built in-tree. The PR adds drivers/hid/hid-apple-mtp-kiwi.c but no Kconfig entry and no Makefile line (neither has a kiwi entry at c5725a2), so CI never compiles it. Please add a HID_APPLE_MTP_KIWI option and a build, and boot it as an in-tree module.
  2. Panel geometry is hardcoded for one board: KIWI_MAX_X/Y (hid-apple-mtp-kiwi.c:51-53, "eDP-1 panel of the k114c") and the 82x54 grid (:45-46). Please take them from the device (frame header, descriptor or a DT property on the transport node), or reject frames whose size doesn't match, so a K116 panel isn't mis-scaled.
  3. The userspace replay harness (.py, .sh, replay.c) belongs under tools/testing/, not drivers/hid/.

The Codex runs failed on quota, so there are no bot findings to answer.

Add Kconfig and Makefile entries for the in-tree module. Only bind on
K114c, and reject frame lengths outside its measured format.

Move the host replay sources into tools/testing. Keep their existing
optional capture and mutation inputs.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
@joshuaswarren

Copy link
Copy Markdown
Contributor Author

Note

🤖 GPT-6.2 Sol responding on behalf of Joshua Warren

20ce1d1bb5c8 adds the in-tree HID_APPLE_MTP_KIWI option and moves the replay tools under tools/testing/selftests/hid/. The driver now binds only on K114c and rejects reports that do not match its measured frame size. A 17,860-byte frame reached the grid decoder before the change. Now it is rejected, and the 17,861-byte frame still reaches the decoder.

Checkpatch reports 0 errors and 0 warnings on the driver and build changes. The in-tree module build and boot, and a full replay at this head, are still open.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the Kconfig/Makefile entry and the move to tools/testing. Two things in 20ce1d1:

  1. kiwi_match() now also requires of_machine_is_compatible("apple,k114c") (hid-apple-mtp-kiwi.c:124-125), and the Kconfig help says other boards are not supported. That selects by machine instead of by what the device reports. The exact frame-size check (:708) is enough to refuse an unknown frame format. Please drop the machine check.
  2. HID: apple-mtp-kiwi: the K114c touch screen (needs #1568) #1605 at b6993a2 now carries the same driver, with the whole-blob suppression and the geometry from touchscreen-size-x/y and touchscreen-x/y-mm. Both PRs add drivers/hid/hid-apple-mtp-kiwi.c and HID_APPLE_MTP_KIWI, so only one can merge. Please fold the frame-size bound into HID: apple-mtp-kiwi: the K114c touch screen (needs #1568) #1605 and close this one, or rebase this one onto HID: apple-mtp-kiwi: the K114c touch screen (needs #1568) #1605 so it only carries that delta.

The replay scripts look for linux-shim.h and baseline2.c, which aren't in the tree, so they exit early when run in-tree. Either add those files or leave the harness out and link to it from the description.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

Note

🤖 GPT-6.2 Sol responding on behalf of Joshua Warren

#1605 now accepts only the measured 17,861-byte Kiwi report. It retains the device match and reads geometry from the Kiwi node. The extracted report callback accepted a 17,860-byte frame before the fix; after it, only the 17,861-byte test frame reached the decoder.

I am closing this PR so one driver lands. The replay scripts need linux-shim.h and baseline2.c, so #1605 does not carry them. The K114c boot row and the other regression rows remain on #1605.

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