Hrm... looks like a bug... srb->cmnd[2] & 0x3F == 0x3F, not 0x01.  This is
probably a leftover from when sd.c used to request page 1, instead of "all
pages" -- I changed this when I discovered devices that didn't implement
page 1, causing the write-protect test to fail.  Requesting all pages is
guaranteed to be good, tho.

Matt

On Mon, Mar 26, 2001 at 11:17:00PM -0600, William Robison wrote:
> Hey Rob:
>      More information...
> 
> Here is a clip of the log with debugging enabled:
> 
>         usb-storage: *** thread sleeping.
>         usb-storage: queuecommand() called
>         usb-storage: *** thread awakened.
>         usb-storage: Command MODE_SENSE (6 bytes)
>         usb-storage: 1a 00 3f 00 08 00 00 00 00 00 1c c0
>         usb-storage: CB_reset() called
>         usb-storage: CB_reset: clearing endpoint halt
> 
> And the clip out of sddr09.c:
> 
>    if (srb->cmnd[0] == MODE_SENSE) {
>                         // Read-write error recovery page: there needs
> to
>                         // be a check for write-protect here
>             if ( (srb->cmnd[2] & 0x3F) == 0x01 ) {
>                         if (ptr==NULL || srb->request_bufflen<4)
>                                 return USB_STOR_TRANSPORT_ERROR;
>                         memcpy(ptr, mode_page_01, sizeof(mode_page_01));
> 
>                         return USB_STOR_TRANSPORT_GOOD;
>            }
>                      // FIXME: sense buffer?
> 
>    return USB_STOR_TRANSPORT_ERROR;
> 
> If I understand things correctly, srb->cmnd[2] is 0x3F so sddr09
> returns an error status.  sd.c seems to ibe snooping for is the
> write protect bit  (buffer[2] & 0x80).
> 
> I'll give the next step a try and let you know in the morning (return
> mode page
> 1 and a good status).
> 
> regards
>    -Willy
> 
>    .  I'll probably have to investigate the ALLOW MEDIUM REMOVAL
> command,
>    but
>    .   the MODE SENSE command is a little puzzling... Can you provide a
>    kernel
>    .   log of the command that gets sent to the driver? The driver is
>    supposed
>    .   to handle one MODE SENSE command, but if there are more it should
> 
>    .   handle, I should probably build those in also
>    .
>    .   Thanks,
>    .
>    .  --Rob
>    .
>    .   Willy wrote:
>    .
>    .   > Greetings:
>    .   >
>    .   >   I hope this is of interest to Matthew Dharm...
>    .   >
>    .   >   Playing with a recently arrived SanDisk SDDR09
>    .   > (box marking SDDR-09-01).
>    .   >
>    .   >   It appears that this device does not want to see
>    .   > "ALLOW MEDIUM REMOVAL"  or "MODE SENSE".
>    .   >
>    .   >   With these commands delivered to the device, a timeout
>    .   > occurs.  A modification to "usb.c" to eliminate these commands,
> 
>    .   > in a manner similar to processing the START_STOP command,
>    .   > seems to eliminate the timeout.  (adding flags to
> unusual_devs.h
>     .  > and usb.h in a manner similar to US_FL_START_STOP).
>    .   >
>    .   >   Note that I've not attempted to provide any data to the
>    MODE_SENSE
>    .   > request, just skipped  it like START_STOP does...
>    .   >
>    .   >   Kernal 2.4.2 pasted into Redhat "fisher"
>    .   >
>    .   > regards
>    .   > -Willy
>    .   > William Robison
> 
> 
> 
> 
> 
> _______________________________________________
> [EMAIL PROTECTED]
> To unsubscribe, use the last form field at:
> http://lists.sourceforge.net/lists/listinfo/linux-usb-devel

-- 
Matthew Dharm                              Home: [EMAIL PROTECTED] 
Maintainer, Linux USB Mass Storage Driver

Hi.  I have my back hairs caught in my computer fan.
                                        -- Customer
User Friendly, 8/20/1998

PGP signature

Reply via email to