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/07/2005 00:30:04
Any updates on this one? Manuel?
Shall I just create the latest version of the patch?
It works and is not a quirk...
- Hubert
On Tue, 29 Nov 2005, Hubert Feyrer wrote:
> On Wed, 23 Nov 2005, Manuel Bouyer wrote:
>>> 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
>
> Yes, it works. :)
> (As there was apparently some confusion: the patch I mailed back last time
> was the only change to -current sources that were necessary to get the cam
> working properly, ignoring the funny "drive offline" message.
>
>
>>> Hm, still readonly device & drive offline...
>>
>> So "readonly device" comes from the ATAPI error register. I'll look at this
>> later.
>> "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).
>
> OK, I finally got around to have a look.
> I changed the code in sd.c:sdattach() to print where it's heading:
>
> error = scsipi_test_unit_ready(periph,
> XS_CTL_DISCOVERY | XS_CTL_IGNORE_ILLEGAL_REQUEST |
> XS_CTL_IGNORE_MEDIA_CHANGE | XS_CTL_SILENT_NODEV);
>
> if (error) {
> ===> printf("HF:sdattach: scsipi_test_unit_ready() returned
> error=%d\n", error);
> result = SDGP_RESULT_OFFLINE;
> } else {
> result = sd_get_parms(sd, &sd->params, XS_CTL_DISCOVERY);
> ===> printf("HF:sdattach: scsipi_test_unit_ready() ok,
> sd_get_parms() returned result=%d\n", result);
> }
>
>
> This gave me, when I attached the cam, the following in dmesg:
>
> 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
> ====> HF:sdattach: scsipi_test_unit_ready() returned error=30
> sd0: drive offline
>
> When running "disklabel sd0" it added:
>
> sd0(umass0:0:0): no door lock
> sd0: fabricating a geometry
>
> So it seems that scsipi_test_unit_ready() failed here.
>
>
>>> 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 ?
>
> I checked vanilla -current before I sent my original message, and it did not
> work. Adding your patch made it work.
>
> I've made sure this is still the case, just in case, it is.
> dmesg after attaching the cam gives:
>
> ...
> 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
>
> Then:
> noon% sudo disklabel sd0
> disklabel: /dev/rsd0d: Read-only file system
>
> So the patch DOES make a difference! :)
>
>
> - Hubert
>