feat(usbd): submit and cancel asynchronous USB transfers #2228
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2228"
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 erick-dsnk on 2026-10-09T12:29:43Z.
What
Depends on #2224.
Implement
sceUsbdSubmitTransferandsceUsbdCancelTransferon the source-built libusb backend introduced by #2224. Submitted transfers now reach native USB I/O, completions copy status, byte counts and isochronous packet results back to the guest object, and cancellation completes through the same callback path. A separate native transfer invokes the original guest callback through the System V ABI, including on Windows. Supporting allocation/free changes preserve resubmission and freeing from callbacks, prevent freeing pending transfers, and release auto-free buffers through the guest heap.This contribution adds 2 implementations beyond #2224: CPU libraries move from 2600/3044 (85.41%) to 2602/3044 (85.48%). The 22 synchronous implementations and dependency files visible in the current diff belong to #2224; they are inherited unchanged. This branch is based on its exact head
3dbf85f0d9be6a45baa955d28528b46058426e27and should merge after it.sceUsbdCheckConnectedstill throws.The asynchronous signatures follow OpenOrbis Usbd.h and shadPS4 declarations. Transfer ownership, flags and completion behavior follow libusb 1.0.30. There is no additional third-party dependency in this follow-up.
PS5 hardware ABI, Windows asynchronous execution, game behavior and physical control/interrupt payloads remain unverified. Linux native tests enumerate devices and read descriptors; transfer completion tests use a deterministic native submission/event backend. These limits are recorded in TechnicalDebt.
Tested
Linux x86-64, GCC 13.3.0, Release, BUILD_TESTING=ON:
--target libs: passed.guest_usbd,guest_usbd_control,guest_usbd_async: passed. Native tests enumerated 17 host devices and read descriptors. The new asynchronous tests use real libusb allocations/context, wrapping only native allocation/free accounting and submit/cancel/event delivery. They verify error translation, double submission rejection, pending-free rejection, cancellation, guest callback identity and data, resubmission, freeing from callbacks, isochronous results, and guest-heap auto-free ownership.ctest --parallel 2 --timeout 30: 512 passed, 1 skipped (agc_driver_storage_cache_budget), 2 failed (agc_driver_dcc_keys_first_writeassertion andagc_driver_flat_storetimeout). Neither involves USB.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-09T12:40:25Z.
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.mdL246docs/dev/TechnicalDebt.mdL23-24Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T20:10:29Z.
Closing with #2224: no title reaches the async Usbd calls on main. Please reopen when one does.
Pull request closed