ChangeSet 1.1587.3.45, 2004/05/11 15:33:09-07:00, stern@rowland.harvard.edu

[PATCH] USB Gadget: Fix file-storage gadget Request Sense length

On Fri, 7 May 2004, kernel@metro.cx wrote:
> Hi All,
>
> I don't know where else to report this, but I found a very very very
> minor bug in the usb gadgets drivers, specifically the file_storage.c
> mass storage driver.
>
> In the function do_request_sense(..) it says:
>
> buf[7] = 18 - 7;                        // Additional sense length
>
> Whereas (according to page 38 of the USB mass storage class, UFI command spec,
> http://www.usb.org/developers/devclass_docs#approved) this clearly neads
> to be equal to 10, not 11.
>
> I checked with the 2.6.5 source, it is still there. Hope someone will find this usefull, although most USB hosts seem to ignore length bits alltogether anyway....
>
> Koen Martens

You are quite right; thank you for pointing this out.  Greg, please apply
the patch below.


 drivers/usb/gadget/file_storage.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


diff -Nru a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
--- a/drivers/usb/gadget/file_storage.c	Fri May 14 15:29:06 2004
+++ b/drivers/usb/gadget/file_storage.c	Fri May 14 15:29:06 2004
@@ -2054,7 +2054,7 @@
 	buf[0] = 0x80 | 0x70;			// Valid, current error
 	buf[2] = SK(sd);
 	put_be32(&buf[3], sdinfo);		// Sense information
-	buf[7] = 18 - 7;			// Additional sense length
+	buf[7] = 18 - 8;			// Additional sense length
 	buf[12] = ASC(sd);
 	buf[13] = ASCQ(sd);
 	return 18;
