Subject: Re: umass woe: sd0(umass0:0:0): readonly device & drive offline
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Hubert Feyrer <feyrer@cs.stevens.edu>
List: tech-kern
Date: 12/09/2005 08:35:17
On Thu, 8 Dec 2005, Manuel Bouyer wrote:
> Yes, I commited the patch. There's still a an issue with the "drive offline"
> message, but I don't know how to properly fix this one ...

Thanks... I think the change you committed was for the netbsd-2 branch or 
so, at least it doesn't built - see error at
http://mail-index.netbsd.org/source-changes/2005/12/09/0000.html.

Here's a patch that builds. I'll followup when the kernel's fully built 
and tested.


  - Hubert

Index: sd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/scsipi/sd.c,v
retrieving revision 1.242
diff -u -r1.242 sd.c
--- sd.c	8 Dec 2005 22:14:19 -0000	1.242
+++ sd.c	9 Dec 2005 07:22:16 -0000
@@ -1361,10 +1361,10 @@
  	 * lock the door of a digicam, which doesn't have a door that
  	 * can be locked) for the SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL command.
  	 */
-	if (xs->cmd.opcode == SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL &&
-	    (sense->flags & SSD_KEY) == SKEY_ILLEGAL_REQUEST &&
-	    sense->add_sense_code == 0x24 &&
-	    sense->add_sense_code_qual == 0x00) { /* Illegal field in CDB */
+	if (xs->cmd->opcode == SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL &&
+	    SSD_SENSE_KEY(sense->flags) == SKEY_ILLEGAL_REQUEST &&
+	    sense->asc == 0x24 &&
+	    sense->ascq == 0x00) { /* Illegal field in CDB */
  		scsipi_printaddr(periph);
  		printf("no door lock\n");
  		periph->periph_flags &= ~PERIPH_REMOVABLE;