Accept USB descriptor extensions and verify endpoint reloads. - #135
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Standard descriptors with legal trailing bytes were rejected, as were zero-bandwidth isochronous endpoints. Parse each defined prefix and advance by the returned length, retaining short-prefix rejection and consistent configuration lengths across reads. Keep bulk payload requirements while allowing zero-bandwidth periodic descriptors. Exercise Linux endpoint reload after alternate selection, including a previously cached alternate and the known-selection path. Describe the existing lexicographic USB location ordering without changing its representation or runtime comparison.
7331722 to
fc919c4
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
USB configuration inspection now accepts legal trailing bytes in standard descriptors and zero-bandwidth isochronous endpoints. It still rejects short defined prefixes, inconsistent configuration lengths and zero-size bulk endpoints. Linux tests also verify endpoint reload after a successful alternate selection, including replacement of a previously cached endpoint set.
The call remains
device.ActiveConfiguration(ctx): descriptors longer than their defined prefixes previously failed; the same call now retains the defined fields and advances by each returned length. A zero-bandwidth isochronous alternate can report a zero maximum packet size. This changes descriptor inspection, without claiming an isochronous transfer backend.Likewise, after
claim.SetAltSetting(1)succeeds,claim.Endpoint(ctx, address)reloads the selected alternate’s endpoints without anotherGET_INTERFACE. Tests check the new endpoint, rejection of the old endpoint, both fresh and previously populated caches, and complete interface/device cleanup. Retain the claim and device under the existing cleanup rules when selection or release fails.Why
USB 2.0 sections 9.5 and 5.6.3 require hosts to tolerate descriptor extensions and permit default isochronous settings without reserved payload bandwidth. Exact-length and nonzero-payload checks rejected those descriptors before an adapter could inspect the configuration. The parser now consumes the known fields and ignores trailing bytes while preserving descriptor and buffer bounds.
The Linux endpoint reload path already retained a successful alternate selection, but had no test that distinguished a reload from a stale cache or an unnecessary interface query. The added tests exercise that path through the USB owner.
Documentation
The Linux USB guide describes descriptor prefixes, zero-bandwidth alternates and endpoint reload. The architecture guide and USB attachment comment now describe the existing location comparison as lexicographic:
10:2precedes2:1among equal serials. Location formatting and runtime ordering are unchanged. These tests add no physical validation claim.