Cleanups to the Device mode Mass Storage demo applications' SCSI routines.
[pub/USBasp.git] / Demos / Device / LowLevel / MassStorage / MassStorage.c
index cf276fd..76aa337 100644 (file)
@@ -189,15 +189,15 @@ void MassStorage_Task(void)
                        if (CommandBlock.Flags & COMMAND_DIRECTION_DATA_IN)\r
                          Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPNUM);\r
 \r
-                       /* Decode the received SCSI command */\r
-                       SCSI_DecodeSCSICommand();\r
+                       /* Decode the received SCSI command, set returned status code */\r
+                       CommandStatus.Status = SCSI_DecodeSCSICommand() ? Command_Pass : Command_Fail;          \r
 \r
                        /* Load in the CBW tag into the CSW to link them together */\r
                        CommandStatus.Tag = CommandBlock.Tag;\r
 \r
                        /* Load in the data residue counter into the CSW */\r
                        CommandStatus.DataTransferResidue = CommandBlock.DataTransferLength;\r
-\r
+                       \r
                        /* Stall the selected data pipe if command failed (if data is still to be transferred) */\r
                        if ((CommandStatus.Status == Command_Fail) && (CommandStatus.DataTransferResidue))\r
                          Endpoint_StallTransaction();\r