Re: [PATCH] fix Sony USB mass storage - pass larger receive buffer

Douglas Gilbert
2003-11-14T02:40:24Z

Patrick Mansfield wrote:
> James - can you please apply? This should not affect other devices since
> we are not changing the requested length, just the size of the receive
> buffer.
>
> This patch against a recent 2.6 bk fixes problems with Sony USB mass
> storage devices: they are sending back 10 bytes even when we ask for 8
> bytes (USB babble).
>
> Just use a larger receive buffer for MODE SENSE even though we are
> requesting 8 bytes.
>
> Tested by Ronald Kuetemei with his Sony camera, also tested with a USB CF
> card reader.
>
> diff -uprN -X /home/patman/dontdiff bl-25/drivers/scsi/scsi_lib.c modesense-bufflen-bk-2.5/drivers/scsi/scsi_lib.c
> --- bl-25/drivers/scsi/scsi_lib.c Mon Sep 29 12:21:09 2003
> +++ modesense-bufflen-bk-2.5/drivers/scsi/scsi_lib.c Mon Nov 10 15:42:03 2003

<snip>

>
> + WARN_ON((buf_len < 8) || (buf_len < len));
> + if (buf_len > 255)
> + buf_len = 255;
> + if (len > 255)
> + len = 255;

Patrick,
SPC-3 section 6.25 (REQUEST SENSE command) [spc3r15.pdf]
says the maximum allocation length should be 252 (not
255). They are steering alway from odd numbers and preferring
the next lower modulo 4 number.

<snip>

> if (!scsi_status_is_good(res))
> - res = sd_do_mode_sense(SRpnt, 0, 0x3F, buffer, 255, &data);
> + res = sd_do_mode_sense(SRpnt, 0, 0x3F, buffer, 255, buf_len,
> + &data);

dito

Doug Gilbert