diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c index 9fae7fc354..b526d7bb6d 100644 --- a/firmware/usbstack/usb_storage.c +++ b/firmware/usbstack/usb_storage.c @@ -219,6 +219,7 @@ static void send_block_data(void *data,int size); static void receive_block_data(void *data,int size); static void identify2inquiry(int lun); static void send_and_read_next(void); +static bool ejected[NUM_VOLUMES]; static enum { WAITING_FOR_COMMAND, @@ -231,6 +232,9 @@ static enum { /* called by usb_code_init() */ void usb_storage_init(void) { + int i; + for(i=0;icommand_block[4] & 0xf0) == 0) /* Process start and eject bits */ + { + if((cbw->command_block[4] & 0x01) == 0 && + (cbw->command_block[4] & 0x02) != 0) /* Stop and eject */ + { + ejected[lun]=true; + } + } send_csw(UMS_STATUS_GOOD); break;