Re: [RFC] usb/usbtest: use URB_ZERO_PACKET for BULK-OUT transfers

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

 



On Fri, Aug 12, 2011 at 12:08:50PM +0300, Felipe Balbi wrote:
> On Tue, Aug 09, 2011 at 05:02:39PM +0200, Sebastian Andrzej Siewior wrote:
> > Executing
> > | testusb -a -c 1 -t 3 -v 421 -s 2048
> > 
> > does not complete on the gadget side.
> > g_zero enqueues a 4096 bytes long buffer. The host sends 2048bytes which
> > is a multiple of wMaxPacketSize. The host is done with sending data but
> > the gadget waits for more.
> > Since the protocol does not include a transfer-length-field sending a
> > terminating zero packet seems the only way out.
> > 
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> > ---
> >  drivers/usb/misc/usbtest.c |    4 +++-
> >  1 files changed, 3 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
> > index bb10846..bd71500 100644
> > --- a/drivers/usb/misc/usbtest.c
> > +++ b/drivers/usb/misc/usbtest.c
> > @@ -359,8 +359,10 @@ static int simple_io(
> >  	urb->context = &completion;
> >  	while (retval == 0 && iterations-- > 0) {
> >  		init_completion(&completion);
> > -		if (usb_pipeout(urb->pipe))
> > +		if (usb_pipeout(urb->pipe)) {
> >  			simple_fill_buf(urb);
> > +			urb->transfer_flags |= URB_ZERO_PACKET;
> > +		}
> >  		retval = usb_submit_urb(urb, GFP_KERNEL);
> >  		if (retval != 0)
> >  			break;
> 
> this looks good to me, as of today, the only way to pass testusb is to
> cancel requests when we start the next one, rather then having them
> completed. Adding a ZLP on the requests, will force the requests to
> complete even though they have a size which is aligned to
> wMaxPacketSize, which allow us to remove the hackish abort transfer on
> all UDCs.

But don't you need that to handle this type of thing properly if it were
to happen with a "real" device?  So you really can't remove that check,
so we should leave the usbtest driver alone, right?

thanks,

greg k-h
--
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