summaryrefslogtreecommitdiff
path: root/supervisor
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2018-11-09 11:33:56 -0800
committerScott Shawcroft <scott@tannewt.org>2018-11-09 11:33:56 -0800
commit43f7ca7985768c974b6881957b21d687c34413ba (patch)
tree83853be3b0197c1c18bcea4f5d3403d48a63e15e /supervisor
parent688f0e388bbb0ae4420c8e3145e83cb15d9b3829 (diff)
Incorporate feedback:
* Clean up board defines. * Add flush on eject and stay ejected. * Swith back to NONE protocol for CDC.
Diffstat (limited to 'supervisor')
-rw-r--r--supervisor/shared/external_flash/external_flash.h2
-rw-r--r--supervisor/shared/usb/usb_msc_flash.c12
2 files changed, 12 insertions, 2 deletions
diff --git a/supervisor/shared/external_flash/external_flash.h b/supervisor/shared/external_flash/external_flash.h
index 852d183a7..72b619a2a 100644
--- a/supervisor/shared/external_flash/external_flash.h
+++ b/supervisor/shared/external_flash/external_flash.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * Copyright (c) 2018 Scott Shawcroft for Adafruit Industries LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/supervisor/shared/usb/usb_msc_flash.c b/supervisor/shared/usb/usb_msc_flash.c
index 72dc40204..13b5c3966 100644
--- a/supervisor/shared/usb/usb_msc_flash.c
+++ b/supervisor/shared/usb/usb_msc_flash.c
@@ -38,6 +38,8 @@
#define MSC_FLASH_BLOCK_SIZE 512
+static bool ejected[1];
+
// The root FS is always at the end of the list.
static fs_user_mount_t* get_vfs(int lun) {
// TODO(tannewt): Return the mount which matches the lun where 0 is the end
@@ -60,7 +62,7 @@ static fs_user_mount_t* get_vfs(int lun) {
// - READ10 and WRITE10 have their own callbacks
int32_t tud_msc_scsi_cb (uint8_t lun, const uint8_t scsi_cmd[16], void* buffer, uint16_t bufsize) {
const void* response = NULL;
- uint16_t resplen = 0;
+ int32_t resplen = 0;
switch ( scsi_cmd[0] ) {
case SCSI_CMD_TEST_UNIT_READY:
@@ -73,6 +75,9 @@ int32_t tud_msc_scsi_cb (uint8_t lun, const uint8_t scsi_cmd[16], void* buffer,
if (current_mount == NULL) {
resplen = -1;
}
+ if (ejected[lun]) {
+ resplen = -1;
+ }
}
break;
@@ -96,6 +101,11 @@ int32_t tud_msc_scsi_cb (uint8_t lun, const uint8_t scsi_cmd[16], void* buffer,
if (current_mount == NULL) {
resplen = -1;
}
+ if (disk_ioctl(current_mount, CTRL_SYNC, NULL) != RES_OK) {
+ resplen = -1;
+ } else {
+ ejected[lun] = true;
+ }
}
}
}