diff options
| author | hathach <[email protected]> | 2019-07-24 17:08:19 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2019-07-24 17:08:19 +0700 |
| commit | 56b656c768a5e1b775ed41a5f74bbf75901f9d74 (patch) | |
| tree | 033f55d046f3205a33dd03d2996e87932b459288 /src/class/msc/msc_device.c | |
| parent | 8ba78ee0129147cba4220dfb63fc5edd1420ad00 (diff) | |
| parent | 1ee9ef4f2b7c6acfab6c398a4f57ca22036958f7 (diff) | |
Merge branch 'master' into develop
Diffstat (limited to 'src/class/msc/msc_device.c')
| -rw-r--r-- | src/class/msc/msc_device.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/class/msc/msc_device.c b/src/class/msc/msc_device.c index 609b4b2ad..07686663b 100644 --- a/src/class/msc/msc_device.c +++ b/src/class/msc/msc_device.c @@ -200,7 +200,7 @@ int32_t proc_builtin_scsi(uint8_t lun, uint8_t const scsi_cmd[16], uint8_t* buff resplen = 0;
if ( !tud_msc_test_unit_ready_cb(lun) )
{
- // not ready response with Failed status and sense key = not ready
+ // Failed status response
resplen = - 1;
// If sense key is not set by callback, default to Logical Unit Not Ready, Cause Not Reportable
@@ -214,7 +214,14 @@ int32_t proc_builtin_scsi(uint8_t lun, uint8_t const scsi_cmd[16], uint8_t* buff if (tud_msc_start_stop_cb)
{
scsi_start_stop_unit_t const * start_stop = (scsi_start_stop_unit_t const *) scsi_cmd;
- tud_msc_start_stop_cb(lun, start_stop->power_condition, start_stop->start, start_stop->load_eject);
+ if ( !tud_msc_start_stop_cb(lun, start_stop->power_condition, start_stop->start, start_stop->load_eject) )
+ {
+ // Failed status response
+ resplen = - 1;
+
+ // If sense key is not set by callback, default to Logical Unit Not Ready, Cause Not Reportable
+ if ( _mscd_itf.sense_key == 0 ) tud_msc_set_sense(lun, SCSI_SENSE_NOT_READY, 0x04, 0x00);
+ }
}
break;
@@ -417,7 +424,7 @@ bool mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t // failed but senskey is not set: default to Illegal Request
if ( p_msc->sense_key == 0 ) tud_msc_set_sense(p_cbw->lun, SCSI_SENSE_ILLEGAL_REQUEST, 0x20, 0x00);
- /// Stall bulk In if needed
+ // Stall bulk In if needed
if (p_cbw->total_bytes) usbd_edpt_stall(rhport, p_msc->ep_in);
}
else
|
