mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-10-09 23:53:28 -04:00
The host configures the device before Rockbox has handed the storage over, and mass storage allocated its buffer right then. On the recording screen the recording buffer still holds all free memory at that point and cannot shrink, so plugging in USB there panicked with "usb_storage_init_connection(): OOM". Recording closes, and frees its buffer, only on SYS_USB_CONNECTED, which the handover broadcasts. Playback does not hit this: its buffer gives memory up on request. The buffer is only needed to run commands, and commands already wait for the handover. So it is allocated, and the endpoint primed for the first command, in the notify event that both handover paths in usb.c send, or at once when the storage is already handed over. Until then the host's first command waits at the endpoint, NAKed. GET_MAX_LUN, which comes before the handover, is answered from the core's control buffer instead of the transfer buffer. Targets with static USB buffers are unchanged. Tested on a Samsung YP-CP3: USB plugged in on the recording screen, at boot and from the main menu, mounts, and files copied both ways keep their checksums. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Change-Id: Icadc24fd52a07d03125234e492dab0ede9e339c9 |
||
|---|---|---|
| .. | ||
| iap | ||
| usb_audio.c | ||
| usb_audio.h | ||
| usb_audio_def.h | ||
| usb_charging_only.c | ||
| usb_charging_only.h | ||
| usb_class_driver.h | ||
| usb_core.c | ||
| usb_hid.c | ||
| usb_hid.h | ||
| usb_hid_def.h | ||
| usb_hid_usage_tables.h | ||
| usb_iap.c | ||
| usb_iap.h | ||
| usb_serial.c | ||
| usb_serial.h | ||
| usb_storage.c | ||
| usb_storage.h | ||