Repository navigation
Conversation
A touch while the driver is PM-suspended still makes the pad raise a report, and with nobody reading it the pad keeps DR asserted. PM resume then drained it like a fresh one. The board resumes the driver when it turns the pad back on (OFF -> ON) and, for touch-to-wake, when it puts the pad in modern standby on a suspended USB bus (OFF -> SLEEP). In the second case the stale report reached the USB passthrough while the bus was suspended and became a remote wakeup: on DVT1, a touch on the "off" pad before suspending the laptop woke it again about a second into suspend. Read and drop whatever is queued at resume, into a local buffer since a drain in flight at suspend may still be dispatching from report_buf. A reset signal among them still restores the retained features. tp_arm_dr() still drains a report that goes ready after that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 1, 2026
There was a problem hiding this comment.
🟡 Changes recommended
Normal report delivery can still process stale touchpad reports after an I2C read failure or through queued or running work during suspend/resume, potentially triggering unwanted USB remote wakeup.
2 open issues
What changed in this PR
This PR updates touchpad PM resume handling to discard reports queued while suspended, preventing stale touches from reaching reconnected hosts or causing unwanted USB wakeups.
Changes:
- Adds a bounded discard loop before rearming the data-ready interrupt.
- Uses a local buffer to avoid interfering with in-flight report dispatch.
- Preserves retained-feature restoration when discarded reports indicate a pad reset.
| File | Description |
|---|---|
drivers/input/hid_touchpad.c |
Adds pending-report discard handling to the PM resume path. |
Review effort: Balanced
Comment on lines
+759
to
+763
| for (int i = 0; i < TP_DRAIN_BURST && gpio_pin_get_dt(&config->dr) > 0; i++) { | ||
| if (tp_lock(data)) { | ||
| return; | ||
| } | ||
| int err = i2c_read_dt(&config->i2c_bus, buf, data->max_input_len); |
Comment on lines
+765
to
+768
| if (err) { | ||
| /* tp_arm_dr() sees DR still asserted and reads it the usual | ||
| * way. */ | ||
| return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Doing state machine analysis on the source, Claude found a race between bluetooth connection and keyboard powering on where a TP could get stuck in a dead state. We haven't seen this reported by dogfooders yet, though it could also have been hidden by some of the other connection issues that we recently fixed. The patch is fairly contained, and I did some regression testing on it, so probably makes sense to take it in early before we do our heavy DVT2 dogfooding.
Claude-generated details
Module half of HW-8311. The board half, which needs this, is FrameworkComputer/zmk-private#181.
touchpad: Drop the reports the pad queued while suspendedreport_buf.tp_arm_dr()still drains a report that goes ready after that.Testing (DVT1, Fedora 44 KDE, cherry-picked onto #2's head
ba720a92with latest zmk-private + open PRs + the board half):Other branches: applies cleanly on #2 (
hw8252-mac-trackpad) and on the localhw-tp-read-retrybranch.🤖 Generated with Claude Code