summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2020-02-25 10:54:42 -0800
committerGitHub <noreply@github.com>2020-02-25 10:54:42 -0800
commit7037ebe0ecdbaedd108d284fb44492d56f2d0c50 (patch)
tree53ad9e888194add688e16534274b0c3434333fbc
parent09ab24b967263856f49d47b7172f139fa5568e1b (diff)
parent876c646d097b79fdf45b94f5d4b1024585fd5cc3 (diff)
Merge pull request #2653 from tannewt/fix_usb_eject_after_sleep
Fix Mac crash when waking up with an ejected CIRCUITPY
-rw-r--r--supervisor/shared/usb/usb_msc_flash.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/supervisor/shared/usb/usb_msc_flash.c b/supervisor/shared/usb/usb_msc_flash.c
index c0279f9e5..7532b6aea 100644
--- a/supervisor/shared/usb/usb_msc_flash.c
+++ b/supervisor/shared/usb/usb_msc_flash.c
@@ -208,6 +208,8 @@ bool tud_msc_test_unit_ready_cb(uint8_t lun) {
return false;
}
if (ejected[lun]) {
+ // Set 0x3a for media not present.
+ tud_msc_set_sense(lun, SCSI_SENSE_NOT_READY, 0x3A, 0x00);
return false;
}
@@ -243,10 +245,8 @@ bool tud_msc_start_stop_cb(uint8_t lun, uint8_t power_condition, bool start, boo
if (disk_ioctl(current_mount, CTRL_SYNC, NULL) != RES_OK) {
return false;
}
- } else {
- // Start the unit, but only if not ejected.
- return !ejected[lun];
}
+ // Always start the unit, even if ejected. Whether media is present is a separate check.
}
return true;