AnyPS5/docs/dev/debt/libSceUsbd.md

2.1 KiB

libSceUsbd technical debt

Silent stubs

  • libSceUsbd implements only the no-device path: sceUsbdInit and sceUsbdExit succeed without a host USB context, the device list is always empty and event handling waits for its timeout; calls that need a device throw. Transfers follow the libusb_transfer layout from libusb.h, which shadPS4 passes to titles as SceUsbdTransfer: sceUsbdAllocTransfer zero-allocates one with its iso packet count (a negative count returns null), sceUsbdFillInterruptTransfer fills the fields libusb_fill_interrupt_transfer sets, and sceUsbdCancelTransfer reports LIBUSB_ERROR_NOT_FOUND mapped to 0x80240005 by shadPS4's 0x80240000 - error rule, since no transfer can be submitted. sceUsbdEventHandlingOk returns 1 because no other thread handles events, and sceUsbdFreeConfigDescriptor accepts only null because no descriptor is ever returned. The device and handle calls take the argument lists of FreeBSD 11.4 libusb (libusb.h) and return 0x80240002 for the null arguments it rejects with LIBUSB_ERROR_INVALID_PARAM (libusb10.c, libusb10_desc.c, libusb10_io.c); a null device or handle in the calls it treats as null-safe returns 0, null or nothing, as there. sceUsbdOpen and sceUsbdGetActiveConfigDescriptor throw on a null device, which libusb dereferences. Any other device or handle was never returned by this library, so those calls throw. The layout, the argument lists and the error codes are unverified on PS5