Repository navigation
feat(usbd): add native synchronous USB backend - #2224
Closed
obojeoboje wants to merge 1 commit into
Closed
obojeoboje wants to merge 1 commit into
obojeoboje wants to merge 1 commit into
Conversation
9 tasks done
9 tasks done
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
|
Collaborator
|
Closing: no title reaches these Usbd calls on main, and a new libusb dependency needs one that does. If you find a title that talks to a USB device, please reopen with its ID and the log line. |
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.
What
Replace 22 throwing
libSceUsbdexports with a synchronous host USB backend using libusb 1.0.30. Previously the library always returned an empty device list and threw on all device operations. It now enumerates real host devices, reads device/configuration/string descriptors, manages device references and handles, claims/releases interfaces, performs control transfers, and exposes native configuration/reset/driver operations.Add libusb as a pinned submodule (
libusb/libusb-cmake, tagv1.0.30-0, commitc8477c10ac2ac6b1718d4d498e102b9f18b776f5) and build it statically from source. Linux uses the bundled netlink enumeration backend rather than a system libudev dependency. Hide native libusb exports from the guest library.Use the signatures, native descriptor layouts and USB error conversion documented by shadPS4 usbd.h and usbd.cpp, with locally written wrappers. Own a separate reference-counted libusb context and convert the guest's 64-bit timeval fields to the host representation.
Transfer allocation/free and interrupt-transfer preparation work, preserving the guest callback pointer. Asynchronous submit/cancel and
sceUsbdCheckConnectedremain throwing stubs. Host permissions and USB drivers apply; console lifecycle and invalid-argument error precedence remain unverified. Record these limits in TechnicalDebt and remove the obsolete no-device silent-stub entry.The progress scanner changes from 2578/3044 (84.69%) to 2600/3044 (85.41%), +22 implementations and +0.72 percentage points.
Tested
Windows, WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON:
Native USB tests enumerated 9 host devices, read cached device descriptors and available configuration descriptors, checked device/list reference lifetimes, repeated initialization/exit, transfer allocation/preparation, SysV guest callback invocation, invalid arguments, and remaining throwing paths.
Deterministic control-transfer tests replace only the native libusb control-transfer call at link time. They verify setup fields, byte counts and buffer output, error conversion (including OTHER), zero/maximum/invalid lengths, string-descriptor requests, and that invalid calls never reach the backend.
Native libusb functions are not exported from the built guest library.
Test registration and conventions checks passed.
cmake --build build --parallel 12completed successfully, as didcmake --build build --target libs --parallel 12.ctest --test-dir build --output-on-failure --parallel 4 --timeout 30: 506 passed, 1 skipped (guest_video_out_wqhd_detection_no_vulkan), 1 timed out (agc_driver_flat_store). The timeout was 30.06 s; no timeout setting was raised.Re-ran
agc_driver_flat_store,guest_usbdandguest_usbd_controlsequentially with the same 30-second limit: all 3 passed (24.19 s, 0.10 s, 0.01 s respectively).No game or homebrew was tested. Physical devices were enumerated and their descriptors read; control-transfer payload tests used the test backend. Linux has not been tested locally.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)