driver_vive: clear_halt before submit_transfer in AttachInterface#356
Open
rocketmark wants to merge 1 commit intocollabora:masterfrom
Open
driver_vive: clear_halt before submit_transfer in AttachInterface#356rocketmark wants to merge 1 commit intocollabora:masterfrom
rocketmark wants to merge 1 commit intocollabora:masterfrom
Conversation
A stalled USB endpoint must be cleared before resubmitting a transfer. Without libusb_clear_halt(), libusb_submit_transfer() will return LIBUSB_ERROR_PIPE (-9) on any endpoint left halted from a previous session or failed transfer, causing the interface attachment to fail. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
610a6a8 to
9f86cc6
Compare
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.
Summary
AttachInterfacecallslibusb_submit_transfer()without first clearing any halt condition on the endpoint. If the endpoint is stalled — from a previous session, a failed transfer, or a device re-enumeration — the submit returnsLIBUSB_ERROR_PIPE(-9) and the interface attachment fails silently.Demonstration
BEFORE —
AttachInterfaceinsrc/driver_vive.c:AFTER:
Impact
Without this, any stalled endpoint causes
AttachInterfaceto fail withLIBUSB_ERROR_PIPE. The device appears to open successfully but receives no data. The fix matches standard libusb practice: always clear halt before the first submit.Change
One call to
libusb_clear_halt(devh, endpoint_num)beforelibusb_submit_transfer()in the libusb path ofAttachInterface.Found via
Observed on hardware after device re-enumeration left an endpoint halted;
libusb_submit_transferreturned -9 and tracking never started.