summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-07-25 22:35:02 +0700
committerhathach <[email protected]>2018-07-25 22:35:02 +0700
commit93db46292a2e9446c8d5be53279dcc6c91613755 (patch)
treec86866bc883d1133c354874d4dc300b41d3b7ebf
parent8fc1d151fc4b47e3d91b683caedf220adee8a630 (diff)
update msc example
-rw-r--r--examples/device/nrf52840/src/msc_device_app.c10
-rw-r--r--src/class/msc/msc.h1
2 files changed, 9 insertions, 2 deletions
diff --git a/examples/device/nrf52840/src/msc_device_app.c b/examples/device/nrf52840/src/msc_device_app.c
index 836dd2d48..1dfce5e16 100644
--- a/examples/device/nrf52840/src/msc_device_app.c
+++ b/examples/device/nrf52840/src/msc_device_app.c
@@ -97,12 +97,18 @@ int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer,
break;
case SCSI_CMD_TEST_UNIT_READY:
- ptr = NULL;
+ // Command that host uses to check our readiness before sending other commands
len = 0;
break;
case SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL:
- ptr = NULL;
+ // Host is about to read/write etc ... better not to disconnect disk
+ len = 0;
+ break;
+
+ case SCSI_CMD_START_STOP_UNIT:
+ // Host try to eject/safe remove/powerof us. We could safely disconnect with disk storage, or go into lower power
+ // scsi_start_stop_unit_t const * cmd_start_stop = (scsi_start_stop_unit_t const *) scsi_cmd
len = 0;
break;
diff --git a/src/class/msc/msc.h b/src/class/msc/msc.h
index ed9fbfce5..333bb4d29 100644
--- a/src/class/msc/msc.h
+++ b/src/class/msc/msc.h
@@ -133,6 +133,7 @@ typedef enum
SCSI_CMD_INQUIRY = 0x12, ///< The SCSI Inquiry command is used to obtain basic information from a target device.
SCSI_CMD_MODE_SELECT_6 = 0x15, ///< provides a means for the application client to specify medium, logical unit, or peripheral device parameters to the device server. Device servers that implement the MODE SELECT(6) command shall also implement the MODE SENSE(6) command. Application clients should issue MODE SENSE(6) prior to each MODE SELECT(6) to determine supported mode pages, page lengths, and other parameters.
SCSI_CMD_MODE_SENSE_6 = 0x1A, ///< provides a means for a device server to report parameters to an application client. It is a complementary command to the MODE SELECT(6) command. Device servers that implement the MODE SENSE(6) command shall also implement the MODE SELECT(6) command.
+ SCSI_CMD_START_STOP_UNIT = 0x1B,
SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E,
SCSI_CMD_READ_CAPACITY_10 = 0x25, ///< The SCSI Read Capacity command is used to obtain data capacity information from a target device.
SCSI_CMD_REQUEST_SENSE = 0x03, ///< The SCSI Request Sense command is part of the SCSI computer protocol standard. This command is used to obtain sense data -- status/error information -- from a target device.