feat(libSceUsbd): implement the device path over the host libusb #1743
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1743"
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 Dextroid17 on 2026-10-08T18:12:08Z.
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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T18:12:34Z.
Progress report (
6b56175→b375bea)📈 System libraries: 85.58% (+0.82%, +25 implemented functions)
✅ 25 implemented
sceUsbdAllocTransfersceUsbdAttachKernelDriversceUsbdCancelTransfersceUsbdCheckConnectedsceUsbdClaimInterfacesceUsbdClosesceUsbdControlTransfersceUsbdEventHandlingOksceUsbdFillInterruptTransfersceUsbdFreeConfigDescriptorsceUsbdFreeTransfersceUsbdGetActiveConfigDescriptorsceUsbdGetBusNumbersceUsbdGetConfigDescriptorsceUsbdGetDeviceAddresssceUsbdGetDeviceDescriptorsceUsbdGetStringDescriptorsceUsbdKernelDriverActivesceUsbdOpensceUsbdRefDevicesceUsbdReleaseInterfacesceUsbdResetDevicesceUsbdSetConfigurationsceUsbdSubmitTransfersceUsbdUnrefDeviceImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T04:35:15Z.
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.
main)docs/dev/TechnicalDebt.mdL23-24core/libs/prx/libSceUsbd/CMakeLists.txtL1-15core/libs/prx/libSceUsbd/Export.cppL3-22, L25-172core/libs/tests/GuestUsbd.cppL1-64docs/dev/TechnicalDebt.mdL24-26Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T08:55:23Z.
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.
Pull request closed