fix: Support interrupt endpoints in nativeTransferIn/nativeTransferOut/clearHalt#4
Merged
thegecko merged 2 commits intoJun 22, 2026
Conversation
…t/clearHalt Adds AnyEndpoint enum wrapping both Bulk and Interrupt endpoint types. get_endpoint now inspects the endpoint descriptor's transfer type at runtime and creates the appropriately typed Endpoint (Bulk or Interrupt). Previously, get_endpoint hardcoded Endpoint<Bulk, DIR>, causing interrupt endpoints to silently fail with 'endpoint not found'.
Member
|
@dressedinblack5 Thanks for this PR, this was an oversight on my part. Apologies I only just saw it, now tested it works as expected. There's a minor formatting issue, would you mind running |
thegecko
approved these changes
Jun 22, 2026
Member
|
Woot! thank you @dressedinblack5 |
Contributor
Author
|
Exciting time in the world, right now! |
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.
Problem
nativeTransferIn,nativeTransferOut, andclearHaltfail with "endpoint not found" for interrupt endpoints. Theget_endpoint()method hardcodesEndpoint<Bulk, DIR>, butnusb::Interface::endpoint::<Bulk, DIR>()validates the descriptor's transfer type at runtime and returns an error when the endpoint is interrupt type.Root Cause
The nusb crate's
EndpointTypetrait hasBulkandInterruptas separate types.Interface::endpoint::<EpType, Dir>()checksep_desc.transfer_type() != EpType::TYPEand rejects mismatches.Fix
Added an
AnyEndpoint<DIR>enum that wraps eitherEndpoint<Bulk, DIR>orEndpoint<Interrupt, DIR>, implementing the shared methods (max_packet_size,transfer_blocking,clear_halt) by delegation.get_endpoint()now inspectsep_desc.transfer_type()at runtime and creates the correctly-typed endpoint.Closes #2
Testing
npm run buildsucceeds on Linux x6403 55 40 01 25= 37%) from interrupt endpoint 3 on an Attack Shark X11 gaming mouse (0x1d57:0xfa60)