diff options
author | Frank Gevaerts <frank@gevaerts.be> | 2008-03-22 21:21:37 +0000 |
---|---|---|
committer | Frank Gevaerts <frank@gevaerts.be> | 2008-03-22 21:21:37 +0000 |
commit | ecde125fa7888a8d0c1fbfac1584caf5f58aa9a7 (patch) | |
tree | 5d0c45862d6c49baf9ebdac338526f893df3f61b | |
parent | 4dc2d8ddba2b1a4da44864b10de628bc45b8f653 (diff) |
Sending an empty data block before sending the FAIL CSW seems to make Windows happier if a device is not present (e.g. an empty sd card slot) (fix proposed by Martin Ritter)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16750 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/usbstack/usb_storage.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c index c528a3a21d..0b433764cf 100644 --- a/firmware/usbstack/usb_storage.c +++ b/firmware/usbstack/usb_storage.c @@ -673,6 +673,8 @@ static void handle_scsi(struct command_block_wrapper* cbw) case SCSI_MODE_SENSE_10: { if(! lun_present) { + /* Windows expects an empty command result before the csw */ + usb_drv_send(usb_endpoint, 0, 0); send_csw(UMS_STATUS_FAIL); cur_sense_data.sense_key=SENSE_NOT_READY; cur_sense_data.asc=ASC_MEDIUM_NOT_PRESENT; @@ -717,6 +719,8 @@ static void handle_scsi(struct command_block_wrapper* cbw) MIN(sizeof(struct mode_sense_data_10), length)); break; default: + /* Windows expects an empty command result before the csw */ + usb_drv_send(usb_endpoint, 0, 0); send_csw(UMS_STATUS_FAIL); cur_sense_data.sense_key=SENSE_ILLEGAL_REQUEST; cur_sense_data.asc=ASC_INVALID_FIELD_IN_CBD; @@ -727,6 +731,8 @@ static void handle_scsi(struct command_block_wrapper* cbw) } case SCSI_MODE_SENSE_6: { if(! lun_present) { + /* Windows expects an empty command result before the csw */ + usb_drv_send(usb_endpoint, 0, 0); send_csw(UMS_STATUS_FAIL); cur_sense_data.sense_key=SENSE_NOT_READY; cur_sense_data.asc=ASC_MEDIUM_NOT_PRESENT; @@ -770,6 +776,8 @@ static void handle_scsi(struct command_block_wrapper* cbw) MIN(sizeof(struct mode_sense_data_6), length)); break; default: + /* Windows expects an empty command result before the csw */ + usb_drv_send(usb_endpoint, 0, 0); send_csw(UMS_STATUS_FAIL); cur_sense_data.sense_key=SENSE_ILLEGAL_REQUEST; cur_sense_data.asc=ASC_INVALID_FIELD_IN_CBD; @@ -819,6 +827,8 @@ static void handle_scsi(struct command_block_wrapper* cbw) } else { + /* Windows expects an empty command result before the csw */ + usb_drv_send(usb_endpoint, 0, 0); send_csw(UMS_STATUS_FAIL); cur_sense_data.sense_key=SENSE_NOT_READY; cur_sense_data.asc=ASC_MEDIUM_NOT_PRESENT; @@ -841,6 +851,8 @@ static void handle_scsi(struct command_block_wrapper* cbw) } else { + /* Windows expects an empty command result before the csw */ + usb_drv_send(usb_endpoint, 0, 0); send_csw(UMS_STATUS_FAIL); cur_sense_data.sense_key=SENSE_NOT_READY; cur_sense_data.asc=ASC_MEDIUM_NOT_PRESENT; @@ -852,6 +864,8 @@ static void handle_scsi(struct command_block_wrapper* cbw) case SCSI_READ_10: logf("scsi read10 %d",lun); if(! lun_present) { + /* Windows expects an empty command result before the csw */ + usb_drv_send(usb_endpoint, 0, 0); send_csw(UMS_STATUS_FAIL); cur_sense_data.sense_key=SENSE_NOT_READY; cur_sense_data.asc=ASC_MEDIUM_NOT_PRESENT; |