Skip to content

Fix USB CD-ROM hang on old UHCI hosts + read-ahead cache for USB 1.1 performance#199

Open
iTechMedic wants to merge 2 commits into
danifunker:mainfrom
iTechMedic:main
Open

Fix USB CD-ROM hang on old UHCI hosts + read-ahead cache for USB 1.1 performance#199
iTechMedic wants to merge 2 commits into
danifunker:mainfrom
iTechMedic:main

Conversation

@iTechMedic

Copy link
Copy Markdown

Summary

Two complementary fixes for USB 1.1 compatibility and performance:

  1. Fix USB CD-ROM enumeration hang on old UHCI hosts — DOS USBASPI on Intel PIIX4 (e.g. Gateway 440LX) pauses the
    bus schedule between enumeration steps. The DWC2 gadget core reported suspend, but Circle's gadget driver had no
    resume path: every EP interrupt while suspended was dropped, making USBASPI wait forever at "Scanning USB
    Devices...". Now handles the wakeup interrupt and restores state on implicit resume (no reset), so USBASPI's resumed
    traffic is processed instead of dropped.

  2. Add read-ahead cache to CUE/BIN image reader — Reduces SD card latency on USB 1.1's low-bandwidth link. Seek()
    records position lazily; Read() checks a 128KB cache first and reads a larger window on miss, so sequential reads
    (game data, Redbook audio) become cache hits instead of fresh SD card accesses. Improves perceived smoothness without
    changing the ~1MB/s throughput ceiling.

Tested on Gateway G6-233 (440LX/PIIX4) with USBASPI 2.27 + USBCD + MSCDEX.

Test plan

  • Boot USBODE on old Intel UHCI hardware with DOS USBASPI driver
  • Verify CD-ROM is detected (no hang at "Scanning USB Devices...")
  • Load files from CD and verify audio playback feels smooth, not jerky
  • Verify no regressions on newer USB 2.0 hosts or Windows 98

David Hauf and others added 2 commits July 3, 2026 22:55
DOS USBASPI on Intel PIIX4 UHCI (e.g. Gateway G6-233/440LX) pauses the
bus schedule between enumeration steps. After >3ms of silence the DWC2
core reports a USB suspend, but the gadget driver had no resume path:
every EP interrupt while suspended (including SETUP_DONE) was
acknowledged and dropped, and only a bus reset could revive it. USBASPI
resumes the bus without resetting, so its SETUP was silently discarded
and it waited forever at "Scanning USB Devices...". Confirmed via debug
log: USB reset -> enum done -> suspend -> total silence, repeating.

Windows never hits this because its UHCI driver doesn't pause SOFs
mid-enumeration.

Adds HandleUSBResume(), unmasks DWHCI_CORE_INT_MASK_WKUP_INTR, and
tracks m_StateBeforeSuspend so EP activity received while suspended
(implicit resume, no reset) restores state and is processed instead of
dropped.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Implements a 128KB sector read-ahead cache in CCueBinFileDevice to reduce
SD card latency visible on the low-bandwidth USB 1.1 link. Seek() now just
records the logical position; Read() checks the cache first and on a miss
reads a larger window so sequential reads (the common case for game data
and Redbook audio streaming) become cache hits instead of incurring fresh
SD card round-trips.

Improves perceived smoothness of loading and audio playback on Full Speed
USB without changing the bandwidth ceiling (still ~1MB/s realistic throughput).
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.

1 participant