Repository navigation
feat(libSceUsbd): implement the device path over the host libusb - #1743
Closed
Dextroid17 wants to merge 1 commit into
Closed
Dextroid17 wants to merge 1 commit into
Dextroid17 wants to merge 1 commit into
Conversation
Progress report (6b56175 → b375bea)📈 System libraries: 85.58% (+0.82%, +25 implemented functions) ✅ 25 implemented
|
8 of 9 tasks
|
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.
|
This was referenced Oct 9, 2026
Collaborator
|
Closing: no title needs these, and loading the host's libusb at runtime with a NOT_SUPPORTED path when it's missing is a fallback the project doesn't take (third-party code goes in as a submodule built from source). If a game turns out to use libSceUsbd, please reopen with the title ID and the call it stops at. |
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
libSceUsbdimplemented only the no-device path: 25 of its 30 declarations calledNotImplemented_nid_no_patch, the device list was always empty and the documented debt entry read "calls that need a device throw". This implements the whole surface over the host's libusb, resolved at runtime, so no new build dependency is added and a build without libusb keeps today's behaviour.How the device path is reached
libusb-1.0is resolved withSDL_LoadObject/SDL_LoadFunction— the same waylibSceAgcDriverresolves the Vulkan loader — andlibSceUsbdlinksSDL2-staticfor it. Where libusb is absent (or a symbol is missing), every call that needs a device returnsSCE_USBD_ERROR_NOT_SUPPORTED(0x8024000C) instead of throwing, the device list stays the empty null-terminated array, andsceUsbdInitstill succeeds. So the no-libusb path is a documented result, not a stub.Signatures
The 25 stubs were declared without parameters, so their signatures are part of this change. They agree with public sources and with the five that already existed:
libSceUsbdexport list (DNNDHH/PS5-3.20_Libs) for the names — it also shows the library mirrors libusb's API;include/orbis/Usbd.h(OpenOrbis/OpenOrbis-PS4-Toolchain) for the prototypes;src/core/libraries/usbd/usbd.cppfor the mapping and the error translation:LIBUSB_ERROR_OTHERto0x802400FF, otherwise0x80240000 - result— which reproduces the existingSCE_USBD_ERROR_INVALID_ARG = 0x80240002forLIBUSB_ERROR_INVALID_PARAM.What is implemented
All 30 declarations: enumeration and list lifetime,
open/close,ref/unref, bus number and device address,get_configuration,set_configuration, the three descriptor reads andfree_config_descriptor,claim/release_interface,kernel_driver_active/attach_kernel_driver,reset_device,check_connected, transferalloc/free/fill_interrupt/submit/cancel,control_transfer,event_handling_okandhandle_events_timeout. Every pointer argument is validated before it reaches libusb, which does not null-check its own.Tested
guest_usbdpasses (it is registered already, so no new test target).sceUsbdInitsucceeds,sceUsbdGetDeviceListreturns a null-terminated list thatsceUsbdFreeDeviceListaccepts,sceUsbdAllocTransfer(0)returns a transfer that frees,sceUsbdEventHandlingOkreturns 1, and the null-argument contracts hold (open,claim,reset,control_transfer,submit,cancel, the descriptor reads).LD_PRELOADinterposingdlopenfor the libusb soname) the same test passes and asserts the fallback: calls needing a device reportSCE_USBD_ERROR_NOT_SUPPORTED.tools/progress.py:libSceUsbdgoes from 5/30 to 30/30, overall 84.76% to 85.58%.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)