Re: [RFC] usb: remove "clear_halt for a busy endpoint" warning

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

 



On Fri, 14 Feb 2014, Stanislaw Gruszka wrote:

> On Thu, Feb 13, 2014 at 11:45:16AM -0500, Alan Stern wrote:
> > @@ -1074,6 +1089,7 @@ static int proc_clearhalt(struct dev_sta
> >  	ret = checkintf(ps, ret);
> >  	if (ret)
> >  		return ret;
> > +	check_reset_of_active_ep(ps->dev, ep, "CLEAR_HALT");
> >  	if (ep & USB_DIR_IN)
> >  		pipe = usb_rcvbulkpipe(ps->dev, ep & 0x7f);
> >  	else
> 
> In documentation is written:

What documentation?  Where?  Maybe the documentation should be updated.

> USBDEVFS_CLEAR_HALT
> 	Clears endpoint halt (stall) and
>         resets the endpoint toggle.  This is only
>         meaningful for bulk or interrupt endpoints.
>         The ioctl parameter is an integer endpoint number
>         (1 to 15, as identified in an endpoint descriptor),
>         masked with USB_DIR_IN when referring to an endpoint which
>         sends data to the host from the device.
>         
>         Use this on bulk or interrupt endpoints which have
>         stalled, returning <emphasis>-EPIPE</emphasis> status
>         to a data transfer request.
>         Do not issue the control request directly, since
>         that could invalidate the host's record of the
>         data toggle.
> 
> Is possible that user space driver can issue dozen of URBs , then get
> -EPIPE for last of them, and then call CLEAR_HALT ?

Certainly that is possible.  It wouldn't trigger the warning, because
after the last URB terminates with -EPIPE there won't be any more URBs
in the queue.

> According
> documentation, this behaviour should be correct.

And indeed, it is correct.

What would be incorrect is if userspace issues dozens of URBs, gets
-EPIPE for the third URB, and then does CLEAR_HALT without first
cancelling all the remaining URBs.

> Or peraps can not issue
> more than one URB for USB_DIR_IN endpoint and should not do CLEAR_HALT
> for USB_DIR_OUT endpoints ?

Userspace definitely _should_ issue more than one URB for IN endpoints.  
Using only one URB at a time is very inefficient for streaming.

Also, userspace _has_ to issue CLEAR_HALT for OUT endpoints.  Otherwise 
the endpoint will become unusable when it halts.

Alan Stern

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