[hatari-devel] Wrong MODE SENSE data length for page code 0x3f

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


Hello,

I noticed that the mode data length field when all pages are returned (page
code 0x3f) is wrong. Instead of 44 it has to be 43. The SPC-5 specification
says: "The mode data length field indicates the number of bytes that follow
in the mode parameter list". "Follow" is the important word here, because
usually fields that contain a byte count do not count themselves.
You also see that something is wrong with the current length field when
running the SCSI Driver test suite. Without the attached patch it says:

       Page 0 (current, not savable)

    Reading all mode pages with MODE SENSE (10)
      MODE SENSE (10) is not supported by device

The empty line indicates that something is wrong. With the attached patch it
says:

        Page 0 (current, not savable)
          0e:00:08:00:00:00:08:00:00:02:00:00:00:00:00
    Reading all mode pages with MODE SENSE (10)
      MODE SENSE (10) is not supported by device

0e:00:08:00:00:00:08:00:00:02:00:00:00:00:00 matches the page 0 data
returned by Hatari.
These data are not really correct, by the way, because they return a
hard-coded sector size of 512 bytes even when a different physical sector
size is configured. But as long as this page is only there to please HDX it
does not matter.

Best regards

Uwe
diff --git a/src/hdc.c b/src/hdc.c
index 424bc081..70c2fac6 100644
--- a/src/hdc.c
+++ b/src/hdc.c
@@ -422,7 +422,7 @@ static void HDC_Cmd_ModeSense(SCSI_CTRLR *ctr)
 		buf = HDC_PrepRespBuf(ctr, 44);
 		HDC_CmdModeSense0x04(dev, ctr, buf + 4);
 		HDC_CmdModeSense0x00(dev, ctr, buf + 28);
-		buf[0] = 44;
+		buf[0] = 43;
 		buf[1] = 0;
 		buf[2] = 0;
 		buf[3] = 0;


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