Skip to content

Commit 7037ebe

Browse files
authored
Merge pull request #2653 from tannewt/fix_usb_eject_after_sleep
Fix Mac crash when waking up with an ejected CIRCUITPY
2 parents 09ab24b + 876c646 commit 7037ebe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

supervisor/shared/usb/usb_msc_flash.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ bool tud_msc_test_unit_ready_cb(uint8_t lun) {
208208
return false;
209209
}
210210
if (ejected[lun]) {
211+
// Set 0x3a for media not present.
212+
tud_msc_set_sense(lun, SCSI_SENSE_NOT_READY, 0x3A, 0x00);
211213
return false;
212214
}
213215

@@ -243,10 +245,8 @@ bool tud_msc_start_stop_cb(uint8_t lun, uint8_t power_condition, bool start, boo
243245
if (disk_ioctl(current_mount, CTRL_SYNC, NULL) != RES_OK) {
244246
return false;
245247
}
246-
} else {
247-
// Start the unit, but only if not ejected.
248-
return !ejected[lun];
249248
}
249+
// Always start the unit, even if ejected. Whether media is present is a separate check.
250250
}
251251

252252
return true;

0 commit comments

Comments
 (0)