Repository navigation
usb: retain DMA transfers and drain cancellable endpoints - #123
Merged
Merged
Conversation
added 2 commits
November 15, 2026 08:30
A server could serve its queued reset acknowledgement without stopping the transport, leaving reset waiting for a read that never ended. Close the local connection after serving the matching response through the existing dispatcher cleanup path. Cover timed and untimed acknowledgements for both roles and timed silent peers. The regression fails when the dispatcher change is removed.
Keep native payload owners until FunctionFS DMA has stopped reading them. Native AIO makes endpoint reads and header/trailer writes cancellable, and connection close drains their real completions before releasing storage. Preserve legacy completion semantics without relaxing error or length checks. Hold complete Gate exchanges under one interface claim, discover named composite interfaces, and synchronize protocol-1 transactions without replaying mutations. Reuse host receive mappings within shared USBFS headroom, retaining mappings and their accounting while applications hold frames. Keep discovery, receive ownership, and DMA cancellation together because they share endpoint lookup and connection lifetime. The complete path is covered by native wire, cancellation, interface, admission, and ownership tests plus USB hardware qualification on RVC2NG, RVC4, and RVC2.
added 3 commits
November 15, 2026 08:41
Use the existing parenthesized std::min pattern so Windows headers cannot expand the Gate deadline and receive-limit calls as macros. Give the reset regression target the platform include directory already used by the other dispatcher tests, so its semaphore headers resolve on macOS and Windows. The native Gate interface test and all six reset cases pass. The changes preserve transfer behavior and let the cross-platform CI jobs compile the new paths.
The Windows semaphore wrapper returned EINVAL when WaitForSingleObject timed out. The server dispatcher therefore treated an ordinary deadline as a wait failure, queued another reset, and waited indefinitely for a silent peer. Map WAIT_TIMEOUT to ETIMEDOUT while preserving EINVAL for other failures. The new reset_server_timed_silent regression exposes this pre-existing Windows defect in both USB configurations.
Exercise transfer headroom and reconnect with the same held frames, so the interface and allocator suites use one modeled kernel budget and handle lifetime. Let CTest bound the reset calls directly.
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.
USB frame transport
Native camera frames keep their existing wire format. The sender queues the camera allocation to FunctionFS and retains it until the controller finishes. The host can reuse USB-mapped receive storage while an application holds earlier frames.
usb_host.cppand the retained write APIusb_host_memory.cppusb_host.cppVerification
On the focused head, 22 loopback/mock tests passed with system libusb and nine USB/reset tests passed with pinned libusb. The Linux receive suites share one allocator fixture. The wildcard discovery-count test gave the same inconsistent count on the target and feature commits in an isolated container. All 28 Linux, macOS and Windows matrix checks also passed on the focused head. This follow-up changes tests only.
Hardware coverage includes retained frames across reconnect on RVC2NG, RVC4 and RVC2, and recovery while USB remains configured. The raw-buffer comparison above isolates host mapping. The separate native dual-camera pipeline delivered 3.04128 Gbit/s of useful pixels over five 30-second runs. Hardware results and lifetime checks