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

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


Hi again,

> The attached patch fixes a small problem with the ACSI drive emulation.

I also noticed that the format of the INQUIRY data returned is a bit
strange. The attached patch contains update INQUIRY data and also
includes the previous change regarding the handling of unsupported LUNs.

Take care

Uwe
diff -r 558497b06d63 src/hdc.c
--- a/src/hdc.c	Mon Oct 07 23:58:34 2013 +0200
+++ b/src/hdc.c	Fri Oct 11 17:23:14 2013 +0200
@@ -89,12 +89,12 @@
 	0,                /* device type qualifier (nonremovable) */
 	1,                /* ANSI version */
 	0,                /* reserved */
-	26,               /* length of the following data */
-	' ', ' ', ' ',                         /* Vendor specific data */
+	31,               /* length of the following data */
+	0,0,0,                                 /* Vendor specific data */
 	'H','a','t','a','r','i',' ',' ',       /* Vendor */
 	'E','m','u','l','a','t','e','d',       /* Model */
-	' ',' ',' ',' ',                       /* Revision */
-	0,0,0,0,0,0,0,0,0,0                    /* ?? */
+	' ',' ',' ',' ',' ',' ',' ',' ',
+	' ',' ',' ',' '                        /* Revision */
 };
 
 
@@ -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/