Adding Ensoniq ASR-10 support and improved FORMAT UNIT command.
[SCSI2SD-V6.git] / software / SCSI2SD / src / scsi.c
index 3d64116..a687cef 100755 (executable)
@@ -281,8 +281,12 @@ static void process_Command()
        {\r
                // REQUEST SENSE\r
                uint32 allocLength = scsiDev.cdb[4];\r
-               if (allocLength == 0) allocLength = 256;\r
-               memset(scsiDev.data, 0, 18);\r
+\r
+               // As specified by the SASI and SCSI1 standard.\r
+               // Newer initiators won't be specifying 0 anyway.\r
+               if (allocLength == 0) allocLength = 4;\r
+\r
+               memset(scsiDev.data, 0, 256); // Max possible alloc length\r
                scsiDev.data[0] = 0xF0;\r
                scsiDev.data[2] = scsiDev.sense.code & 0x0F;\r
 \r
@@ -292,23 +296,12 @@ static void process_Command()
                scsiDev.data[6] = transfer.lba;\r
 \r
                // Additional bytes if there are errors to report\r
-               int responseLength;\r
-               if (scsiDev.sense.code == NO_SENSE)\r
-               {\r
-                       responseLength = 8;\r
-               }\r
-               else\r
-               {\r
-                       responseLength = 18;\r
-                       scsiDev.data[7] = 10; // additional length\r
-                       scsiDev.data[12] = scsiDev.sense.asc >> 8;\r
-                       scsiDev.data[13] = scsiDev.sense.asc;\r
-               }\r
+               scsiDev.data[7] = 10; // additional length\r
+               scsiDev.data[12] = scsiDev.sense.asc >> 8;\r
+               scsiDev.data[13] = scsiDev.sense.asc;\r
 \r
                // Silently truncate results. SCSI-2 spec 8.2.14.\r
-               enter_DataIn(\r
-                       (allocLength < responseLength) ? allocLength : responseLength\r
-                       );\r
+               enter_DataIn(allocLength);\r
 \r
                // This is a good time to clear out old sense information.\r
                scsiDev.sense.code = NO_SENSE;\r