[hatari-devel] Patch for INQUIRY command (ACSI emulation)

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi all,

The attached patch fixes a small problem with the ACSI drive emulation.
For unsupported LUNs the INQUIRY command should not return an error code
but should actually handle the command. The information that the LUN is not
supported has to be coded in the response data (Peripheral Qualifier and
Peripheral Device Type). The SCSI standard provides the details.
Can you please commit this patch to the source repository? Thank you.

Take care

Uwe
diff -r 1100567cbf16 src/hdc.c
--- a/src/hdc.c	Mon Oct 07 00:08:03 2013 +0200
+++ b/src/hdc.c	Thu Oct 10 23:55:39 2013 +0200
@@ -192,6 +192,10 @@
 	if (count > (int)sizeof(inquiry_bytes))
 		count = sizeof(inquiry_bytes);
 
+        /* For unsupported LUNs set the Peripheral Qualifier and the
+           Peripheral Device Type according to the SCSI standard */
+        inquiry_bytes[0] = HDC_GetDevice() == 0 ? 0 : 0x7F;
+
 	inquiry_bytes[4] = count - 8;
 
 	if (STMemory_SafeCopy(nDmaAddr, inquiry_bytes, count, "HDC DMA inquiry"))
@@ -907,8 +911,9 @@
 #ifdef HDC_REALLY_VERBOSE
 		HDC_DebugCommandPacket(stderr);
 #endif
-		/* If it's aimed for our drive, emulate it! */
-		if (HDC_GetDevice() == 0)
+		/* If it's aimed for our drive, emulate it!
+                   INQUIRY must always be handled, see SCSI standard */
+		if (HDC_GetDevice() == 0 || HDCCommand.opcode == 0x12)
 		{
 			HDC_EmulateCommandPacket();
 		}


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/