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]

 



Hi,

On Fri, Apr 01, 2011 at 11:29:20AM -0400, Alan Stern wrote:
> > Ok, thanks for the info. I'll spend some time with it during next week.
> > What do you suggest in this case ? I mean, we shouldn't be doing short
> > transfers with this gadget driver, right ? And if block size is always
> > 512, how can we transfer one block without having a short transfer ?
> 
> "Short" means "shorter than expected", not "shorter than the maxpacket 
> size".
> 
> > Should we, then make the block size == wMaxPacketSize and keep aligning
> > on a block boundary ?
> 
> The correct approach is to align on the larger of the block size and
> the maxpacket size (provided one is a multiple of the other, which
> isn't always true with wireless USB!).  In theory short transfers

I like this approach. Will play with it next week :-)

Just to be sure I understood, you mean something like:

if (!(ep->maxpacket % block_size))
	align = max(ep->maxpacket, block_size);
else
	align = block_size;

amount &= ~(align - 1);

???

> shouldn't occur, but it doesn't matter much if they do, provided they
> are a multiple of the block size.

What about controllers which can't handle Short on RX ?

-- 
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