Repository navigation
hid-service: fix passthrough failure handling and configure buffer sizes - #990
Merged
felipebalbi merged 4 commits intoNov 21, 2026
Conversation
Contributor
Author
|
This PR must wait for #984 to be merged! |
felipebalbi
marked this pull request as ready for review
November 19, 2026 18:48
felipebalbi
requested review from
RobertZ2011,
kurtjd,
tullom,
williampMSFT and
wmmc88
and
a balanced review from Copilot
November 19, 2026 18:48
felipebalbi
enabled auto-merge (squash)
November 19, 2026 18:48
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The response can complete before the upstream interrupt pin is deasserted, risking a spurious host interrupt; a deassertion acknowledgement and an integration test verifying the ordering are needed.
1 open issue
What changed in this PR
Builds on #984’s descriptor-refresh work to improve HID-over-I2C passthrough failure handling and support larger descriptors and host commands, addressing the buffer limits described in #987 and #989.
Changes:
- Adds explicit device-failure completions and validates completion routing before waking the host.
- Updates interrupt completion handling and adds regression tests for recovery, scheduling, and buffer boundaries.
- Makes device and host buffer capacities independently configurable while preserving the 512-byte and 128-byte defaults.
| File | Description |
|---|---|
hid-service/src/i2c/passthrough/mod.rs |
Adds buffer-size options, awaits interrupt operations, and tests macro configurations. |
hid-service/src/i2c/passthrough/interrupt.rs |
Handles coalesced completion signals and adds interrupt-state regression tests. |
hid-service/src/i2c/host.rs |
Accepts failure completions and validates destination and device identity. |
hid-service/src/i2c/device.rs |
Refreshes descriptor metadata, reports request failures, and adds bridge and capacity tests. |
hid-service/Cargo.toml |
Adds dependencies for host-side async tests. |
embedded-service/src/hid/mod.rs |
Introduces the shared HID failure message and sending API. |
Cargo.lock |
Records the added HID-service test dependencies. |
Review effort: Balanced
Send explicit HID failure completions when a consumed request returns an error. Distinguish failures from successful commands with no response, preserve portable HID errors for the host, and retain original HAL/buffer errors for device-side logging. Validate completion destination and device ID before waking the host. Keep request processing serialized; do not introduce host timeouts that could confuse late, uncorrelated responses. Add compile-time device-buffer overrides to passthrough macros. Keep the legacy 512-byte allocation; integrations can select 1129 bytes for the ELAN HC4909-20H5V0 report descriptor documented in I2C Programming Guide v1.0, sections 2.1 and 3.3. The separate 128-byte host buffer is unchanged. Await interrupt-state requests in generated host tasks. Handle coalesced completion, idle reset, and notifications posted between consumption and state inspection without leaking them into the next interrupt exchange. Pin failure/retry behavior, routing, actual macro allocations, and interrupt output transitions with inline behavioral tests. Expand both composite macro forms in compile fixtures. MessageData gains a public Failure variant; downstream exhaustive matches may need updating. This is not a HID wire-format change. Cancellation and physical controller abort/resynchronization remain caller/HAL responsibilities. Validation: 89 scoped unit tests and one doctest pass; formatting, Clippy, workspace checking, and ARM Clippy pass. Full workspace tests remain blocked on Windows/MSVC by existing debug-service defmt and espi-service ARM linker failures. Refs: OpenDevicePartnership#987
Add an optional buffer_size to the generated host task and forward host_buffer_size independently through the composite macro. Keep the 128-byte legacy allocation and existing device-size option. The ELAN HC4909-20H5V0 I2C Programming Guide v1.0, sections 3.5 and 3.5.5 Figure 12, documents an IAP frame with length 0x0083. Let integrations select sufficient storage for that 131-byte example without treating it as the maximum for every possible command. Leave parser bounds checks and device response storage unchanged. Run the real composite-generated host task against a complete scripted IAP packet. Verify the forwarded feature request and all payload bytes, successful completion, and acceptance of the next command. Check rejection with 128/130-byte buffers and compile all four combinations of legacy, device, host, and combined options. Payload contents and the host sequence are synthetic. These tests establish software ingress capacity, not physical touchpad update success, actual OS sequencing, or controller recovery. No hardware corroboration is claimed and no OpenDevicePartnership#988 length adjustment is made. Validation: 89 scoped unit tests and one doctest pass. Formatting, Clippy, workspace checking, and ARM Clippy pass. Full workspace tests retain the existing Windows/MSVC linker failures in debug-service and espi-service. Refs: OpenDevicePartnership#989
Drive the forwarded interrupt high before allowing the generated host task to process or answer a request. A notification alone does not establish that ordering on a cooperative executor. Deprecate the notification-only deassert method without changing its signature. Add deassert_and_wait with explicit GPIO error reporting, and release the output mutex while the interrupt task waits. Retain successful pin-level confirmation so interrupt cleanup cannot repeat a fallible HIGH write and reassert LOW during a pending response. Pin ordering through the real generated host task with its interrupt task deliberately unpolled. Cover GPIO failure without forwarding or responding, consecutive exchanges, idle notifications, failed-write retry, and cleanup after an already-confirmed deassertion. This does not address the separate upstream transaction-recovery gap. Refs: OpenDevicePartnership#990, OpenDevicePartnership#991 Assisted-by: OpenCode:gpt-6.1-sol
felipebalbi
added a commit
to felipebalbi/embedded-services
that referenced
this pull request
Nov 19, 2026
Drive the forwarded interrupt high before allowing the generated host task to process or answer a request. A notification alone does not establish that ordering on a cooperative executor. Deprecate the notification-only deassert method without changing its signature. Add deassert_and_wait with explicit GPIO error reporting, and release the output mutex while the interrupt task waits. Retain successful pin-level confirmation so interrupt cleanup cannot repeat a fallible HIGH write and reassert LOW during a pending response. Pin ordering through the real generated host task with its interrupt task deliberately unpolled. Cover GPIO failure without forwarding or responding, consecutive exchanges, idle notifications, failed-write retry, and cleanup after an already-confirmed deassertion. This does not address the separate upstream transaction-recovery gap. Refs: OpenDevicePartnership#990, OpenDevicePartnership#991 Assisted-by: OpenCode:gpt-6.1-sol
felipebalbi
force-pushed
the
fix/hid-passthrough-recovery
branch
from
November 19, 2026 21:15
0053ae1 to
f837fb2
Compare
kurtjd
previously approved these changes
Nov 19, 2026
Contributor
|
What's the difference between this PR and #991? It looks like the commits here are the last three commits in that PR. |
Contributor
Author
RobertZ2011
requested changes
Nov 20, 2026
Pull in the comments from PR OpenDevicePartnership#991 explaining interrupt test polling phases and the deprecated deassert API migration window.
RobertZ2011
approved these changes
Nov 20, 2026
jerrysxie
approved these changes
Nov 21, 2026
felipebalbi
merged commit Nov 21, 2026
995c234
into
OpenDevicePartnership:stable-v0.1.y
15 checks passed
felipebalbi
added a commit
that referenced
this pull request
Nov 23, 2026
Bring the fixes from #984 and #990 to `main`, preserving original commits and authors. - Refresh HID metadata and fix passthrough failure, routing, and interrupt handling. - Make host/device buffer capacities configurable. - Require main-first integration checks for stable backports. Validated: workspace tests, formatting, Clippy, and affected-crate host/ARM feature checks. Closes #987 Closes #989 --------- Co-authored-by: Yourong Tang <yourongtang@microsoft.com>
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.

Closes #987
Closes #989