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 Mon, Apr 04, 2011 at 11:15:28AM -0400, Alan Stern wrote:
> > > > HW requests OUT transfers to be aligned on wMaxPacketSize.
> > > 
> > > That doesn't seem to be related to my question: Why are you worrying
> > > about short transfers?
> > 
> > not worrying about short transfers per se, I just want gadget driver to
> > pass me request->length (for RX/OUT only) which is divisable by
> > wMaxPacketSize, so I don't have to keep on guessing what size should I
> > use.
> 
> You don't have to guess.  Always use request->length.  :-)

can't in all cases, see below

> > See, if gadget passes me request->length which isn't divisible by
> > wMaxPacketSize I have two options:
> > 
> > a. round-down:
> > 	That would mean I would need another buffer to receive the
> > 	remaining request->length % ep->maxpacket and later memcpy()
> > 	those remaining bytes to request->buf
> > 
> > b. round-up:
> > 	Simply can't, I don't know if gadget driver has allocated more
> > 	than request->length.
> 
> You left out the correct, third choice: Don't round; use the value you 
> were asked to use.

Like I said before: HW requests me to give lengths which are divisible
by wMaxPacketSize. I can't quote parts of the HW docs here, but I *must*
give the HW sizes which are divisible by wMaxPacketSize in case of OUT
transfers.

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