Repository navigation
feat(libSceUsbd): pass USB devices and transfers through to the host with libusb - #3848
Conversation
Progress report (84659e1 → 42cf829)📈 System libraries: 87.19% (+0.04%, +10 implemented functions) ✅ 10 implemented
|
adriadam10
left a comment
There was a problem hiding this comment.
Thanks for the rework. Built the PR merged onto main and ran guest_usbd: it passes, and it fails without the change.
One problem to fix:
core/libs/prx/libSceUsbd/Export.cpp:254-262(sceUsbdCancelTransfer): the mutex is released beforelibusb_cancel_transfer(host). If another thread runssceUsbdHandleEventsTimeoutandCompleteTransferfinishes (libusb_free_transfer(host)) in between,hostis a dangling pointer. Keepstate.mutexlocked across thelibusb_cancel_transfercall (it does not invoke the callback synchronously, soCompleteTransfertaking the same mutex cannot deadlock), or otherwise make the lookup and the cancel atomic. A test with one thread cancelling while another pumps events would pin it.
This is stacked on #3847, so it also has to wait for that one to merge.
Fix pushed
|
e91ec2b to
21f764e
Compare
|
Thanks — the cancel lock is fixed in 21f764e: While running the device path on Windows with the Xbox 360 controller (VID 3537, PID 100F) I found a second crash in the test, present before this PR and without it: On the updated head 59dca59 with the controller live: the full device run including the cancel-vs-events race completes 3 for 3, exit 0; |
59dca59 to
6f0f3c1
Compare
6f0f3c1 to
42cf829
Compare
adriadam10
left a comment
There was a problem hiding this comment.
Rebased onto current main; the only conflict was docs/dev/TechnicalDebt.md, whose libSceUsbd entry now lives in docs/dev/debt/libSceUsbd.md, so I moved the PR's updated line there. No logic changed.
Checked on Linux with the PR merged onto main: full build, guest_usbd passes and fails without the change (no-device path only, no USB access here), whole ctest green. The cancel-under-lock fix from the earlier review is in. Device, isochronous and PS5 behaviour were not run here and stay as recorded in TechnicalDebt; merging once CI is green.
|
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.
|
What
Replaces the no-device path with host libusb 1.0.30, built from a new
3rdparty/libusb-cmakesubmodule (pinned to bea6567).static_assertpins sizes and offsets.0x80240000 - code, withLIBUSB_ERROR_OTHERas0x802400FF, as in shadPS4.sceUsbdHandleEventsTimeout. Transfer flags other than short-not-ok and add-zero-packet throw.This builds on LordLava's closed #2870, which used the same submodule and approach. Stacked on #3847; until that merges the diff shows both commits.
Tested
guest_usbd devicewithAPS5_USBD_DEVICE=3537:100flists the device, reads its device and config descriptors and product string, does a synchronous control request, claims and releases all three interfaces, and completes an asynchronous control transfer through the event loop. Each result matches the controller's own descriptor.guest_usbdrun passes.check_conventions.pypasses. Isochronous transfers and PS5 behaviour are unverified, as recorded in TechnicalDebt. Not tested with a title.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)