feat(libSceUsbd): declare the device and handle calls for the no-device path #3847

Merged
13hourstilliland merged 1 commit from upstream-pr/3847 into main 2026-10-11 22:09:30 +00:00
13hourstilliland commented 2026-10-11 17:55:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by 13hourstilliland on 2026-10-11T17:55:20Z.


What

Gives the 19 remaining libSceUsbd stubs the argument lists of FreeBSD 11.4 libusb (libusb.h). The device list is always empty, so each call either rejects its arguments or throws:

  • Null arguments FreeBSD rejects with LIBUSB_ERROR_INVALID_PARAM return 0x80240002.
  • Null arguments FreeBSD accepts (bus number, address, ref, unref, close) return 0, null or nothing, as there.
  • sceUsbdOpen and sceUsbdGetActiveConfigDescriptor throw on a null device, which FreeBSD dereferences.
  • Any other device or handle throws, since this library never returned it.

The no-device approach is the one tarfouss3 took in the closed #2493; the behaviour here follows the FreeBSD sources linked in TechnicalDebt (libusb10.c, libusb10_desc.c, libusb10_io.c).

Tested

Linux (GCC 14.2): guest_usbd covers the null, accepted and unknown-pointer paths of every new call. It aborts on current main (sceUsbdOpen not implemented) and passes with this change. check_conventions.py passes. Not tested with a title.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4821110025 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3847). Originally posted by [13hourstilliland](https://github.com/13hourstilliland) on 2026-10-11T17:55:20Z. --- ### What Gives the 19 remaining `libSceUsbd` stubs the argument lists of FreeBSD 11.4 libusb ([libusb.h](https://github.com/freebsd/freebsd-src/blob/d106002967eff712894ab8b5337bbbff106ce5e0/lib/libusb/libusb.h)). The device list is always empty, so each call either rejects its arguments or throws: - Null arguments FreeBSD rejects with `LIBUSB_ERROR_INVALID_PARAM` return `0x80240002`. - Null arguments FreeBSD accepts (bus number, address, ref, unref, close) return 0, null or nothing, as there. - `sceUsbdOpen` and `sceUsbdGetActiveConfigDescriptor` throw on a null device, which FreeBSD dereferences. - Any other device or handle throws, since this library never returned it. The no-device approach is the one tarfouss3 took in the closed #2493; the behaviour here follows the FreeBSD sources linked in TechnicalDebt ([libusb10.c](https://github.com/freebsd/freebsd-src/blob/d106002967eff712894ab8b5337bbbff106ce5e0/lib/libusb/libusb10.c), [libusb10_desc.c](https://github.com/freebsd/freebsd-src/blob/d106002967eff712894ab8b5337bbbff106ce5e0/lib/libusb/libusb10_desc.c), [libusb10_io.c](https://github.com/freebsd/freebsd-src/blob/d106002967eff712894ab8b5337bbbff106ce5e0/lib/libusb/libusb10_io.c)). ### Tested Linux (GCC 14.2): `guest_usbd` covers the null, accepted and unknown-pointer paths of every new call. It aborts on current `main` (`sceUsbdOpen not implemented`) and passes with this change. `check_conventions.py` passes. Not tested with a title. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-11 17:55:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T17:55:44Z.


Progress report (a11c8f7 → 33c6e82)

📈 System libraries: 86.37% (+0.56%, +19 implemented functions)

✅ 19 implemented
Library Name
libSceUsbd sceUsbdAttachKernelDriver
libSceUsbd sceUsbdCheckConnected
libSceUsbd sceUsbdClaimInterface
libSceUsbd sceUsbdClose
libSceUsbd sceUsbdControlTransfer
libSceUsbd sceUsbdGetActiveConfigDescriptor
libSceUsbd sceUsbdGetBusNumber
libSceUsbd sceUsbdGetConfigDescriptor
libSceUsbd sceUsbdGetDeviceAddress
libSceUsbd sceUsbdGetDeviceDescriptor
libSceUsbd sceUsbdGetStringDescriptor
libSceUsbd sceUsbdKernelDriverActive
libSceUsbd sceUsbdOpen
libSceUsbd sceUsbdRefDevice
libSceUsbd sceUsbdReleaseInterface
libSceUsbd sceUsbdResetDevice
libSceUsbd sceUsbdSetConfiguration
libSceUsbd sceUsbdSubmitTransfer
libSceUsbd sceUsbdUnrefDevice
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6111954648 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3847#issuecomment-6111954648). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T17:55:44Z. --- <!-- progress-report --> ### Progress report (a11c8f7 → 33c6e82) 📈 **System libraries**: 86.37% (+0.56%, +19 implemented functions) <details> <summary>✅ 19 implemented</summary> | Library | Name | | - | - | | libSceUsbd | `sceUsbdAttachKernelDriver` | | libSceUsbd | `sceUsbdCheckConnected` | | libSceUsbd | `sceUsbdClaimInterface` | | libSceUsbd | `sceUsbdClose` | | libSceUsbd | `sceUsbdControlTransfer` | | libSceUsbd | `sceUsbdGetActiveConfigDescriptor` | | libSceUsbd | `sceUsbdGetBusNumber` | | libSceUsbd | `sceUsbdGetConfigDescriptor` | | libSceUsbd | `sceUsbdGetDeviceAddress` | | libSceUsbd | `sceUsbdGetDeviceDescriptor` | | libSceUsbd | `sceUsbdGetStringDescriptor` | | libSceUsbd | `sceUsbdKernelDriverActive` | | libSceUsbd | `sceUsbdOpen` | | libSceUsbd | `sceUsbdRefDevice` | | libSceUsbd | `sceUsbdReleaseInterface` | | libSceUsbd | `sceUsbdResetDevice` | | libSceUsbd | `sceUsbdSetConfiguration` | | libSceUsbd | `sceUsbdSubmitTransfer` | | libSceUsbd | `sceUsbdUnrefDevice` | </details>
adriadam10 commented 2026-10-11 22:09:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T22:09:26Z.


Checked against the linked FreeBSD libusb10.c, libusb10_desc.c and libusb10_io.c: every null branch matches (null-safe: bus number, address, ref, unref, close; LIBUSB_ERROR_INVALID_PARAM → 0x80240002: descriptors, claim/release, configuration, reset, check-connected, kernel-driver calls, control/string transfer, submit). guest_usbd passes on Linux and fails without the change; check_conventions.py passes. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114397781 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3847#issuecomment-6114397781). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T22:09:26Z. --- Checked against the linked FreeBSD `libusb10.c`, `libusb10_desc.c` and `libusb10_io.c`: every null branch matches (null-safe: bus number, address, ref, unref, close; `LIBUSB_ERROR_INVALID_PARAM` → `0x80240002`: descriptors, claim/release, configuration, reset, check-connected, kernel-driver calls, control/string transfer, submit). `guest_usbd` passes on Linux and fails without the change; `check_conventions.py` passes. Merging.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!3847
No description provided.