feat(libs): implement libSceUsbd over libusb #2870
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2870"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by LordLava on 2026-10-10T17:12:53Z.
What
Implements
libSceUsbd, the console's libusb 1.0 wrapper, replacing the 25 throwing stubs and 5 partial functions with a real host backend. All 61 exports the library is known to have are implemented and none callsNotImplemented_nid_no_patch;tools/progress.pyreportsdone 61, todo 0(was 5/30).libSceUsbdis a thin wrapper over libusb on the console: its exports, argument lists and error codes are libusb's, with the context and the transfer's own callback hidden behind a global context and a per-process registry. The guest-visible structures are layout identical to libusb's, whichstatic_assertonsizeofandoffsetofpins at compile time, so device, handle, descriptor and transfer pointers cross the boundary without a copy. libusb error codes are translated to0x80240000 - code, withLIBUSB_ERROR_OTHERat0x802400FF; the same static assertions pin every constant.Two details worth flagging for review:
sceUsbdFill*Transferfunctions park the guest callback in a registry, restore the user data pointer before invoking it, and drop the entry when the transfer completes or is freed.The new third-party dependency is
libusb-cmake, the CMake build project libusb officially links to, as a submodule pinned at tagv1.0.30-0. libusb has no CMake build of its own. It is built statically with position-independent code so it links into the shared.prxwithout adding a runtime file tolibs/.Tested
Linux x86-64, GCC 16.2.1, cmake 4.4.4, against libusb 1.0.30 built from the pinned submodule.
ctest -R guest_usbdequivalent (GuestUsbd) passes: initialization, device enumeration and descriptor reads against the host's real devices, the empty-list and null-argument paths, event handling with a zero and a 50 ms timeout, transfer allocation and filling, the callback round-trip, and the isochronous packet buffer bounds.python3 tools/check_conventions.py --base main --head HEADreports All conventions checks passed.git submodule update --init 3rdparty/libusb-cmake.guest_usbdis registered as a test by the library'sCMakeLists.txt, so CI covers it.Not tested, and worth saying plainly:
3rdpartysubmodules are not checked out in my environment, so I could not runcmake --build build --target libsor start a game. CI runs the full build.docs/dev/TechnicalDebt.mdunder thelibSceUsbdentry, including the PS4-sourced prototypes, the Windowstimevalconversion, and the three exports where libusb has no equivalent and behaviour had to be chosen (sceUsbdCheckConnected,sceUsbdClaimInterface,sceUsbdOpenDeviceWithVidPid)./dev/bus/usbaccess, so device access paths (open, claim, transfer submission) return real libusb errors but never complete successfully in the test.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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T17:13:03Z.
Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
Pull request closed