Subject: Re: umass woe: sd0(umass0:0:0): readonly device & drive offline
To: Hubert Feyrer <>
From: Manuel Bouyer <>
List: tech-kern
Date: 11/23/2005 12:27:43
On Wed, Nov 23, 2005 at 12:14:55AM +0100, Hubert Feyrer wrote:
> On Sun, 20 Nov 2005, Manuel Bouyer wrote:
> >Also the error should be ignored only when trying to lock/unlock the door.
> >please try the attached patch instead.
> Against what NetBSD version/sources/branch is that patch?

-current, but maybe not up-to-date current. It's possible that I forgot to
cvs up before looking at this.

On Wed, Nov 23, 2005 at 02:18:38AM +0100, Hubert Feyrer wrote:
> OK, I figured it out, apparently a few things were changed in -current... 
> I'll append the updated patch below. A full dmesg output including 
> SCSI_VERBOSE is also available, see 

Hum, there's something odd here.
Ha, this is using ATAPI over USB. The device didn't report a complete SCSI
sense data, it just set a sense code in the error register.
Maybe this part of the code isn't up to date with recent ATAPI specs, or
the device is acting strange. I'll try to have a look at recent ATAPI

> Output I get via dmesg is
> 1) after plugging the cam in:
> 	umass0 at uhub0 port 1 configuration 1 interface 0
> 	umass0: DSC DIGITAL CAMERA USB, rev 1.00/1.00, addr 2
> 	umass0: using ATAPI over Bulk-Only
> 	atapibus0 at umass0: 2 targets
> 	scsipi_inqmatch: 2/0/1 <, , >
> 	sd0 at atapibus0 drive 0: <DIGITAL, CAMERA, 1.00> disk removable
> 	sd0(umass0:0:0): readonly device
> 	sd0: drive offline
> 2) After accessing:
> 	sd0(umass0:0:0): no door lock
> 	sd0: fabricating a geometry

At last my patch seens to work and properly detect the missing door lock

> Hm, still readonly device & drive offline...

So "readonly device" comes from the ATAPI error register. I'll look at this
"drive offline" is from sd.c:sdattach(). Can you try to see if it's
because scsipi_test_unit_ready() fails, or because sd_get_parms() fails ?
If it's sd_get_parms() please track down to the command failing
(probably somewhere in sd_get_capacity() in this case).

> And what's that scsipi_inqmatch?

A debug message under SCSI_DEBUG. It's used to match a device's ID string
against a table (to choose driver, find quirky devices, etc ...)

> Anyways, maybe I should point out that I've tried this on -current with no 
> other patches, and I got the camera mounted fine.

You mean, the patch I sent is needed, or does current work out of the box ?

Manuel Bouyer <>
     NetBSD: 26 ans d'experience feront toujours la difference