Hi, On 09/13/2013 02:35 PM, Nathan Hjelm wrote: > > On Sep 13, 2013, at 3:18 AM, Hans de Goede <hdego...@redhat.com> wrote:
<snip> >> 2) The alloc_streams backend op should not fail when the user requests more >> streams >> then available, instead it should simply allocate the number of >> available streams >> available and return that (as mentioned in the doxygen docs) >> >> So this is wrong: >> >> + (*(cInterface->interface))->SupportsStreams (cInterface->interface, >> pipeRef, &supportsStreams); >> + if (num_streams > supportsStreams) { >> + rc = LIBUSB_ERROR_INVALID_PARAM; >> + break; >> + } >> >> And should be: >> >> + (*(cInterface->interface))->SupportsStreams (cInterface->interface, >> pipeRef, &supportsStreams); >> + if (num_streams > supportsStreams) >> + num_streams = supportsStreams >> >> Note the check for how many streams are supported is done inside the kernel >> with Linux, and it will continue with the maximum number of streams supported >> if the user request more streams, so it is hard to implement any other logic >> under Linux, while it seems easy to mimick the Linux behavior with darwin. > > Hmm, what exactly are the semantics under Linux if the endpoints support a > different number of streams? The xhci driver (which implements this) first iterates over all endpoints to find the minimum support by all of them. Then if the minimum <= 1 it bails with an error (no streams supported on 1 or more eps), if the minimum > 1, it allocates the minimum found on all eps. > To mimic I will either need to take the minimum first and allocate that for > each endpoint (returning an error if any endpoint returns 0 supported > streams) or just allocate the smaller of num_streams or the maximum supported > streams for each endpoint and return the mimimum. Right, you need to "calculate" the minimum first. > >> Maybe we should log a warning when returning less streams then requested? >> If we want to log a warning it would be best to actually do that in the >> core.c alloc_streams wrapper, so that it is consistently done for all >> backends. > > Sounds fine to me. Regards, Hans ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. Consolidate legacy IT systems to a single system of record for IT 2. Standardize and globalize service processes across IT 3. Implement zero-touch automation to replace manual, redundant tasks http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel