Skip to content

usbd_mini: restore FreeUsbd for WoC USB regression (#908) - #911

Open
horizonends wants to merge 1 commit into
ps2dev:masterfrom
horizonends:fix/usbd-mini-freeusbd
Open

usbd_mini: restore FreeUsbd for WoC USB regression (#908)#911
horizonends wants to merge 1 commit into
ps2dev:masterfrom
horizonends:fix/usbd-mini-freeusbd

Conversation

@horizonends

Copy link
Copy Markdown

Summary

  • Restore FreeUsbd (ps2sdk @2dc6b32f, pre-b1f7ff96) as the implementation of usbd_mini only
  • Leave full iop/usb/usbd on the SCE rewrite (HID report descriptors, multi-isochronous, etc.)
  • Keep export table at usbd 1.2 with stubs for usbdReboot / sceUsbdGetReportDescriptor / sceUsbdMultiIsochronousTransfer (USB_RC_NOSUPPORT / no-op)

Fixes the hardware regression in #908: Crash Bandicoot: Wrath of Cortex over USB in OPL (embeds usbd_mini). Symptom: mid-transfer hang with fail_count=0 (TD submitted, completion never wakes). Standalone usbstress does not reproduce.

Isolation

usbd usbmass WoC USB
rewrite modern fail
FreeUsbd (pre-b1f7ff96) old works
FreeUsbd modern works

So modern usbmass_bd is fine; the rewrite’s usbd_mini path is not. Many FreeUsbd-vs-rewrite A/Bs on the rewrite were tried (HCD bring-up, WDH/DoneHead, dual TD queues, embedded ED, hub flush, SetAddress timing, attach/transferedBytes, timer delay-=1, etc.) — none restore play after the cutscene. Dead list on #908.

This does not claim to fix the rewrite; it restores the known-good driver for the mini module OPL actually ships.

Related

Test plan

  • make -C iop/usb/usbd_mini builds
  • OPL Beta-2245 tree + this usbd_mini + SDK usbmass_bd_miniOPNPS2LD-freeusbd-mini.ELF staged for hardware
  • Hardware: WoC USB past cutscene on PAL slim (same as known-good old-usbd pin)
  • Spot-check USB mass still enumerates in OPL menu

OPL embeds usbd_mini; the post-b1f7ff96 rewrite breaks Wrath of Cortex
over USB (TD completes never wake WaitSema). Hardware shows old FreeUsbd
usbd + modern usbmass works. Give usbd_mini its own FreeUsbd sources
(from 2dc6b32) and keep the SCE rewrite for full usbd. Export table
stays 1.2 with stubs for reboot/report/multi-isoc.
@horizonends

Copy link
Copy Markdown
Author

Hardware confirm: OPL with this usbd_mini + current SDK usbmass_bd_mini — Crash Bandicoot: Wrath of Cortex over USB on PAL slim plays past the cutscene (same as the known-good old-usbd pin).

@sp193

sp193 commented Aug 15, 2026

Copy link
Copy Markdown
Member

Normally, the app is designed and built with a specific SDK version in mind, which is not really what our homebrew world does because our SDK contains modules that are based on modules from different SDK versions. Sony does not change the default IOP module versions, even when they release new PS2 models.

But I don't think we should be maintaining another project's dependencies in the SDK. Otherwise, we could have N copies of the source code, for N homebrew software.

I excused myself from working on PS2 homebrew software for about 8 years now. I recall that the USB module code was originally in OPL's repository. Then the new maintainers probably relocated them here, to avoid duplicating the code - which IMO is a good move. But if we are going to undo that, then the correct way may be to store the code back in OPL's repository, not here.

A greater concern may be whether this is a sign of instability.

When I fixed the original USBD for correct operation on some console (I forgot what), I did that my comparing the logic against the assembly of the similar module. One problem is that we're not the hardware developers and built the module without Sony's support. Any hardware and software bugs or limitations are undocumented. So my solution was to make the SDK libraries work as similarly as possible to the original, to avoid such issues.

@rickgaiser

Copy link
Copy Markdown
Member

There have been issues ever since this PR (#661) from 2 years ago.

It's a complete rewrite / reverse engineered usbd module. Perhaps it's better to revert the entire commit, becouse the old usbd was carefully fixed over many years, but the new usbd seems totally unsupported. @uyjulian what's your thoughts?

For neutrino I use my own ps2sdk neutrino branch where I revert (309ebcd) it.

@sp193

sp193 commented Aug 16, 2026

Copy link
Copy Markdown
Member

The only thing I really didn't like about that PR, was how the structure changed so much. So much that we cannot easily compare the 2, to have an idea what the differences are. Unless this actually meant that Sony possibly did a major rewrite too (which is possible, seeing the way MCMAN worked before and after some point at SDK 2.x).

I wrote the "instability" remark because the author mentioned some hang on some internal logic, in the OPL-side PR. However, not every malfunction necessarily means we wrote bad code because games could have undetected bugs too.

If @uyjulian strongly believes that this new structure and version is very much better to have, I guess we can still try to move forward with it. We just need to be sure that the I/O logic (previously in hcd.c and a little more) are correct. The PS2 has a OHCI USB controller so most of the USB logic is in hardware.

@sp193

sp193 commented Aug 16, 2026

Copy link
Copy Markdown
Member

If we deem that this version of USBD is good and the issue lies with this game, then I would say either:

  1. The game should be debugged and a patch should be made.
  2. OPL should go back to having its own version of USBD.

@uyjulian

uyjulian commented Aug 16, 2026

Copy link
Copy Markdown
Member

It fixed some things (e.g. games requiring the isosynchronous interfaces) but also broke some things.

It would be nice to figure out what exactly is the issue. I suspect thread stack space due to the added features but not entirely sure. Needs further debugging. (but my DTL-T system doesn't work consistently right now so slowly working on improving alternatives)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants