On Fri, Jul 19, 2013 at 5:20 AM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote: > On Thu, 18 Jul 2013, Clemens Ladisch wrote: > >> In any case, there must be _some_ mechanism to explicitly restart >> a stream. I do not really care if this is some URB flag or some >> function call. > > I prefer a function call over the flag. The function call can easily > be issued just once, but the completion routine would have to clear the > flag every time the URB gets used. IMO, one good candidate is to do it in usb_set_interface(), and we may avoid changes on most of drivers which are using isoc endpoints, also it is reasonable, see blow: >From "5.6.3 Isochronous Transfer Packet Size Constraints" of USB spec 2.0: All device default interface settings must not include any isochronous endpoints with non-zero data payload sizes (specified via wMaxPacketSize in the endpoint descriptor). Alternate interface settings may specify non-zero data payload sizes for isochronous endpoints. that said all drivers which are using isoc endpoints have to call usb_set_interface(altsetting) explicitly before starting isoc schedule. So for isoc drivers, it is very reasonable to call usb_set_interface(altsetting) before starting streaming and call usb_set_interface(0) after stopping streaming. I think we may document this usage, then use this info as starting/stopping stream flag. Looks both uvc and uac drivers support this way. If one driver doesn't call usb_set_interface(0) after streaming off, we can think it as buggy since the device still consumes bus bandwidth unnecessary and may cause other device's bandwidth requirement not satisfied on same bus. > > Maybe we can use usb_reset_endpoint() for this purpose after all. It > is a perfect fit, because we want to tell the HCD to reset the > isochronous endpoint back to the "start of stream" state. I suggest not to introduce extra starting stream function to usb_reset_endpoint(), and if we have to do this, I suggest to add a new API for the purpose cleanly. > A search under drivers/ shows that only a few HCDs other than ehci > currently implement the endpoint_reset method: xhci, whci, dwc2, and > ozwpan. It would not be hard to fix them up to ignore calls for > isochronous endpoints. >From xhci_endpoint_reset(), looks the hcd doesn't rule out isoc endpoint. Actually 'start of stream' should be done inside usbcore because it is HCD-independent function, so it is better to provide the information from usbcore and let HCD use it if HCD needs the flag. Thanks, -- Ming Lei -- 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