Possible patch for MODE_SENSE?

Matthew Dharm (mdharm-kernel@one-eyed-alien.net)
Mon, 27 Aug 2001 12:55:48 -0700


--s2ZSL+KKDSLx8OML
Content-Type: multipart/mixed; boundary="X1bOJ3K7DJ5YkBrT"
Content-Disposition: inline

--X1bOJ3K7DJ5YkBrT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Warning, this is crossposted to several lists. Beware of Reply-To-All.

Attached to this message is a one-line patch which changes the way Write
Protect detection is done in sd.c

Formerly, we requested "all pages" but only "8 bytes" so we could get the
header data to test the WP bit. But, I'm seeing more and more devices
which _really_ don't like this... and we wind up with bizzare results,
because the device basically is confused.

The problem is, apparently, our friends in Redmond don't do it this way.
And that's all anyone ever designs towards anymore.

This patch increases the requested data to 255 bytes. That's enough in the
testing I've done (or had people do -- about 3 different devices, so far)
to avoid the problem entirely.

I'd like people to try this patch and let me know if it breaks anything on
their system. I don't think it should -- any device which responded
properly to request for 8 bytes should work fine with larger requests, and
devices which didn't work the old way will either (a) still not work, or
(b) start working.

At least, that's the theory.

I'd like some wider testing on this... can people give it a whirl and let
me know what they get?

Matt Dharm

--=20
Matthew Dharm Home: mdharm-usb@one-eyed-alien.=
net=20
Maintainer, Linux USB Mass Storage Driver

I'll scuff my feet on the carpet and zap your nose hairs unless you=20
TALK mister!! Who put you up to this?
-- Pitr
User Friendly, 3/30/1998

--X1bOJ3K7DJ5YkBrT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

diff -u -uNr linux-2.4.9/drivers/scsi/sd.c linux/drivers/scsi/sd.c
--- linux-2.4.9/drivers/scsi/sd.c Sat Aug 25 15:57:07 2001
+++ linux/drivers/scsi/sd.c Fri Aug 24 14:56:01 2001
@@ -1020,7 +1020,7 @@
cmd[1] = (rscsi_disks[i].device->scsi_level <= SCSI_2) ?
((rscsi_disks[i].device->lun << 5) & 0xe0) : 0;
cmd[2] = 0x3f; /* Get all pages */
- cmd[4] = 8; /* But we only want the 8 byte header */
+ cmd[4] = 255; /* But we only want the 8 byte header */
SRpnt->sr_cmd_len = 0;
SRpnt->sr_sense_buffer[0] = 0;
SRpnt->sr_sense_buffer[2] = 0;

--X1bOJ3K7DJ5YkBrT--

--s2ZSL+KKDSLx8OML
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7iqXEz64nssGU+ykRAqXIAJ9/SnzalbvXHu28AdD8+V4MVPz0UgCgvwWq
/8tOQgh1fNGnMSuKbB9/cfM=
=r4KN
-----END PGP SIGNATURE-----

--s2ZSL+KKDSLx8OML--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/