mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-10-10 08:03:04 -04:00
A host that is done with a mass-storage device - "safely remove", eject, udisksctl power-off - sends START STOP UNIT with the start bit clear, and may cut power right after. usb_storage only marked the LUN ejected. Storage drivers can still hold data in RAM at that point: a flash translation layer keeps part-written pages until a later write completes them, and HAVE_STORAGE_FLUSH exists so they can be committed - but only shutdown and ROLO called it. On a device unplugged after a proper eject and then losing power, that data was lost although the host had done everything right. Call storage_flush() on stop and on eject, on targets that define HAVE_STORAGE_FLUSH. The SCSI handler runs in the USB thread, as do the reads and writes, so the flush cannot race them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Change-Id: I5b5811858c75dfb3ee89535ab59f4a19663945df |
||
|---|---|---|
| .. | ||
| 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 | ||