Repository navigation
HID: spi-hid-apple: resync and retry failed get reports - #782
Closed
RyanTheTide wants to merge 2 commits into
Closed
RyanTheTide wants to merge 2 commits into
RyanTheTide wants to merge 2 commits into
Conversation
A bad write status is currently only logged, so GET_REPORT waits for a reply to an unacknowledged command and eventually fails the trackpad's dimensions query. Treat that status as a failed get, allow the completed SPI transaction to settle with CS inactive, and invalidate incomplete receive assembly before retrying. Retry lost replies as well, with at most three attempts, and report an error only after recovery fails. Serialize synchronous gets and match responses by interface, report and request ID, arming the waiter before transmitting. This prevents delayed responses from satisfying a subsequent attempt. Bound the reply copy to the caller's buffer. Preserve best-effort SET/OUTPUT behavior and never replay commands that may have side effects. Add KUnit fault injection using a fake SPI controller for bad status, lost and stale replies, retry limits, reply bounds and non-replayed sets. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Include the interface, command, report and sequence ID in the existing warning so a malformed acknowledgement can be associated with its request during recovery verification. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Contributor
Author
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.
A bad SPI write status currently logs a warning but reports success. The synchronous get then waits for a reply that may never arrive, and the trackpad's first open can fail before its dimensions are installed.
Retry GET_REPORT up to three times after a bad status or lost reply, with a CS-inactive settling interval and receive reassembly reset. Serialize gets, arm reply matching before transmission, and reject stale request IDs/report numbers. Bound response copies to the caller's buffer. SET/OUTPUT commands retain their existing behavior and are never replayed.
Adds six KUnit cases using a fake SPI controller: bad-status recovery, dropped replies, stale replies, exhausted retries, short destination buffers, and non-replayed sets.
Validation at
1f1973ab0417345df13d81ff76754901a1933952:W=1 -j8 drivers/hid/spi-hid/ drivers/hid/hid-magicmouse.owith both drivers enabled: passed, zero warning/error diagnostics.W=1 -j8 Image modules: passed; warnings remain in unchanged code outside the affected files.drivers/hid/spi-hid/.kunitconfig, built withW=1: all six tests passed, zero failures or skips. The build reports warnings in unchanged code outside this driver.git diff --check: passed. Prior strict checkpatch of the code diff passed apart from the generic new-file MAINTAINERS reminder.The 20-boot hardware soak and measured axis-range checks remain pending in the hardware lane. No candidate has been installed or booted for this validation. Keep this PR as a draft. The original wire-level cause of the malformed acknowledgement remains unproven; this patch addresses the missing transport recovery path. Synthetic tests do not establish real firmware resynchronization.