Possible patch for MODE_SENSE?
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
Signature · 7 lines
Matthew Dharm Home: [email protected] Maintainer, Linux USB Mass Storage Driver I'll scuff my feet on the carpet and zap your nose hairs unless you TALK mister!! Who put you up to this? -- Pitr User Friendly, 3/30/1998
drivers/scsi/sd.c +1 -1
@@ -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 ;