8000 Revert "atmel-samd: Tweak mass storage code to finish read sooner." · boneskull/circuitpython@bfe7e05 · GitHub
[go: up one dir, main page]

Skip to content

Commit bfe7e05

Browse files
committed
Revert "atmel-samd: Tweak mass storage code to finish read sooner."
This reverts commit 182a946.
1 parent b4fc464 commit bfe7e05

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ports/atmel-samd/usb_mass_storage.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,6 @@ int32_t usb_msc_xfer_done(uint8_t lun) {
259259
if (active_read) {
260260
active_addr += 1;
261261
active_nblocks--;
262-
if (active_nblocks == 0) {
263 8E5C -
active_read = false;
264-
}
265262
}
266263

267264
if (active_write) {
@@ -275,6 +272,10 @@ int32_t usb_msc_xfer_done(uint8_t lun) {
275272
// The start_read callback begins a read transaction which we accept but delay our response until the "main thread" calls usb_msc_background. Once it does, we read immediately from the drive into our cache and trigger the USB DMA to output the sector. Once the sector is transmitted, xfer_done will be called.
276273
void usb_msc_background(void) {
277274
if (active_read && !usb_busy) {
275+
if (active_nblocks == 0) {
276+
active_read = false;
277+
return;
278+
}
278279
fs_user_mount_t * vfs = get_vfs(active_lun);
279280
disk_read(vfs, sector_buffer, active_addr, 1);
280281
// TODO(tannewt): Check the read result.

0 commit comments

Comments
 (0)
0