Re: PATCH: exclude certain commands from emulated SCSI hosts

Alan Stern
2003-04-22T18:01:12Z

On 22 Apr 2003, James Bottomley wrote:

> On Tue, 2003-04-22 at 12:22, Andries.Brouwer@cwi.nl wrote:
> [...]
>
> Actually, could this
>
> > Apr 9 17:34:55 lemon: usb-storage: Invoking Mode Translation
>
> Be the root cause? It indicates that usb storage modified the command.

No, most likely it's not the cause.

> In 2.5.68 that's doing a translation from MODE SENSE(6) to MODE
> SENSE(10) inside the driver.
>
> But the odd thing in usb/storage/protocol.c is this (about line 354):
>
> case MODE_SENSE:
> case MODE_SELECT:
> srb->cmd_len = 12;
> srb->cmnd[11] = 0;
> srb->cmnd[10] = 0;
>
> Why is a 10 byte command given a command length of 12?

The USB protocol used by this device is presumably one that requires all
commands to be 0-padded to 12 bytes.

More interesting is this:

> Apr 9 17:34:55 lemon: usb-storage: Command MODE_SENSE (6 bytes)
> Apr 9 17:34:55 lemon: usb-storage: 1a 00 3f 00 04 00

<snip>

> Apr 9 17:34:55 lemon: usb-storage: usb_stor_bulk_transfer_buf(): xfer 4 bytes
> Apr 9 17:34:55 lemon: usb-storage: Status code -75; transferred 4/4

The error is -EOVERFLOW, which means that the device tried to send back
more data than we were prepared to receive, i.e., more than 4 bytes. That
4 comes from the second-to-last byte of the MODE-SENSE command. But there
is a comment in drivers/storage/usb/protocol.c indicating that 8 is the
minimum size for a MODE-SENSE (line 257). That might or might not be
accurate, or it might not apply to this sort of device. But it is
suggestive.

Alan Stern