diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2009-08-26 07:51:40 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2009-08-26 07:51:40 +0000 |
commit | a765f717273728139966f97c634ccffe52d218df (patch) | |
tree | c3f7f833a1ff82315e6b4f9793a4b2aa7d5a51c5 /LUFA/Drivers/USB/Class/Host/MassStorage.c | |
parent | 31d8ebebc0796873f7c70db80a04acdcbb307ed8 (diff) | |
download | lufa-a765f717273728139966f97c634ccffe52d218df.tar.gz lufa-a765f717273728139966f97c634ccffe52d218df.tar.bz2 lufa-a765f717273728139966f97c634ccffe52d218df.zip |
Add SCSICodes.h to the Class Driver Common folder, and automatically include it in both the Host and Device Mass Storage Class drivers. Delete existing version from the ClassDriver MassStorage device demo's /Lib/ folder.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Host/MassStorage.c')
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/MassStorage.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.c b/LUFA/Drivers/USB/Class/Host/MassStorage.c index a0b34610c..1610e422a 100644 --- a/LUFA/Drivers/USB/Class/Host/MassStorage.c +++ b/LUFA/Drivers/USB/Class/Host/MassStorage.c @@ -310,11 +310,53 @@ uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t* Max return ErrorCode;
}
-uint8_t MS_Host_GetInquiryData(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, SCSI_Inquiry_Response_t* InquiryData)
+uint8_t MS_Host_GetInquiryData(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex, SCSI_Inquiry_Response_t* InquiryData)
{
if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.Active))
return HOST_SENDCONTROL_DeviceDisconnect;
+
+ uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
+
+ MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
+ {
+ .Signature = CBW_SIGNATURE,
+ .Tag = MSInterfaceInfo->State.TransactionTag,
+ .DataTransferLength = sizeof(SCSI_Inquiry_Response_t),
+ .Flags = COMMAND_DIRECTION_DATA_IN,
+ .LUN = LUNIndex,
+ .SCSICommandLength = 6,
+ .SCSICommandData =
+ {
+ SCSI_CMD_INQUIRY,
+ 0x00, // Reserved
+ 0x00, // Reserved
+ 0x00, // Reserved
+ sizeof(SCSI_Inquiry_Response_t), // Allocation Length
+ 0x00 // Unused (control)
+ }
+ };
+
+ MassStore_SendCommand(MSInterfaceInfo, &SCSICommandBlock);
+
+ if ((ErrorCode = MassStore_WaitForDataReceived()) != PIPE_RWSTREAM_NoError)
+ {
+ Pipe_Freeze();
+ return ErrorCode;
+ }
+ if ((ErrorCode = MassStore_SendReceiveData(MSInterfaceInfo, (uint8_t*)InquiryPtr)) != PIPE_RWSTREAM_NoError)
+ {
+ Pipe_Freeze();
+ return ErrorCode;
+ }
+
+ if ((ErrorCode = MassStore_GetReturnedStatus(MSInterfaceInfo)) != PIPE_RWSTREAM_NoError)
+ {
+ Pipe_Freeze();
+ return ErrorCode;
+ }
+
+ return ErrorCode;
}
uint8_t MS_Host_TestUnitReady(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex, bool* DeviceReady);
|