Re: [PATCH] usb: gadget: file_storage: don't assume wMaxPacketSize to be 512

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 01, 2011 at 01:56:14PM +0400, Sergei Shtylyov wrote:
> On 01-04-2011 13:50, Felipe Balbi wrote:
> 
> >we shouldn't assume that value because on SuperSpeed, we have
> >1024 as wMaxPacketSize.
> 
> >Signed-off-by: Felipe Balbi<balbi@xxxxxx>
> [...]
> 
> >diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
> >index a6eacb5..9dab5df 100644
> >--- a/drivers/usb/gadget/file_storage.c
> >+++ b/drivers/usb/gadget/file_storage.c
> >@@ -1249,6 +1249,7 @@ static int do_read(struct fsg_dev *fsg)
> >
> >  static int do_write(struct fsg_dev *fsg)
> >  {
> >+	struct usb_ep		*ep = fsg->bulk_out;
> >  	struct fsg_lun		*curlun = fsg->curlun;
> >  	u32			lba;
> >  	struct fsg_buffhd	*bh;
> >@@ -1331,7 +1332,7 @@ static int do_write(struct fsg_dev *fsg)
> >  				curlun->info_valid = 1;
> >  				continue;
> >  			}
> >-			amount -= (amount & 511);
> >+			amount -= ~(ep->maxpacket - 1);
> 
>    This is not correct. You were told to use:
> 
> 			amount &= ~(ep->maxpacket - 1);

my bad, missed the &= change. Sorry, overlooked that. Thanks for the
catch.

-- 
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux