Commit Graph
9 Commits
Author SHA1 Message Date
Dean a98262ce94 Merge pull request #9339 from MaxLikesCode/feat/usbd-event-calls
feat(libSceUsbd): handle events with FreeBSD libusb's event lock and handler thread
2026-11-02 20:57:30 +13:00
MaxandClaude Opus 5.5 9f3799cfaa fix(libSceUsbd): wake event waiters after each pass of event handling
FreeBSD 11.4's libusb10_handle_events_sub ends every pass, a timed-out
one included, with pthread_cond_broadcast on the context's condition
variable, so a thread in libusb_wait_for_event wakes after each pass of
the handler. Here waiters woke only when the handler unlocked, so a
waiter could sleep through the handler's whole loop. Notify them when
the handler takes the event lock back after a pass.

The follower test that expected a timeout while the handler ran 20 ms
passes now races that wake-up, so guest_usbd checks three cases
instead: a follower with a long timeout returns 0 after a pass, a
follower times out during a longer pass, and a follower returns after
the handler held the event lock past its timeout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 15:27:07 +01:00
MaxandClaude Opus 5.5 dbb27b9ef1 feat(libSceUsbd): handle events with FreeBSD libusb's event lock and handler thread
sceUsbdLockEvents, sceUsbdTryLockEvents, sceUsbdUnlockEvents,
sceUsbdLockEventWaiters, sceUsbdUnlockEventWaiters, sceUsbdWaitForEvent,
sceUsbdEventHandlerActive, sceUsbdHandleEvents and
sceUsbdHandleEventsLocked follow FreeBSD 11.4 libusb10_io.c: one lock
for events and their waiters, one handler thread that releases the lock
while the host libusb handles events, and waiters that are woken when
the handler unlocks and take over handling when there is none.
sceUsbdEventHandlingOk now reports whether the calling thread is the
handler, and sceUsbdHandleEventsTimeout takes the same path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 15:19:36 +01:00
simnJS 692cc3e025 test(libSceUsbd): race the cancel on an interrupt endpoint the host can read
The device test raced sceUsbdCancelTransfer on the first interrupt IN endpoint of the device. On Windows the first one can belong to a mouse or keyboard collection, which the system opens exclusively, so libusb's HID backend cannot read it and the submission failed, reported as a failed cancel race. The test now tries each interrupt IN endpoint, requires a refusal to be the host's I/O error with nothing in flight, and races on the first one the host accepts, with a buffer sized from that endpoint.
2026-10-28 14:51:59 +01:00
MaxandClaude Opus 5.5 64ae578dda feat(libSceUsbd): pass the device, packet size, alternate setting and halt calls through to libusb
sceUsbdGetDevice, sceUsbdGetDeviceSpeed, sceUsbdGetMaxPacketSize,
sceUsbdGetMaxIsoPacketSize, sceUsbdOpenDeviceWithVidPid,
sceUsbdSetInterfaceAltSetting, sceUsbdClearHalt and
sceUsbdDetachKernelDriver follow FreeBSD 11.4 libusb10.c over the host
libusb. The packet sizes and the alternate setting checks are done as
FreeBSD does them, so the library records which interfaces are claimed,
and a device stays known while a handle to it is open.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 01:50:33 +02:00
simnJS 66f467e406 feat(libSceUsbd): pass configuration and descriptor queries through to libusb 2026-10-21 16:57:03 +02:00
juanpimg 1f1add461e feat(prx): declare the missing PS5 3.20 system exports in the next tier of libraries
AnyPS5 resolves a title's imports by NID, so a title that imports a system
function that no AnyPS5 library provides fails to load with an unresolved
import. This declares 222 such exports across 11 PS5 system libraries that
AnyPS5 implements but does not provide.

Each declaration calls NotImplemented_nid_no_patch and returns 0; none of
them implements the function. A declaration with a credible prototype uses
it and cites the source with a pinned commit; the rest are declared without
parameters, which resolves the import without making an ABI claim. The
technical-debt files record the limitation per library.

The list is the intersection of the export table of the console's library
(function symbols only), the pinned aerolib names and the functions not yet
defined anywhere in the repo. Every name recomputes to its NID with
tools/nid_names.py.

libSceAudio3d and libSceVoice are left out because #8331 declares them.
2026-10-20 23:22:17 +02:00
Semir Kabir 98d594c9c1 feat(libSceUsbd): pass USB devices and transfers through to the host with libusb 2026-10-12 22:32:42 +02:00
Adrià FranchandClaude 342a8c4590 docs(debt): move library entries to one file per library
Co-Authored-By: Claude <[email protected]>
2026-10-12 20:38:29 +02:00