On 2013.09.25 16:36, Kano wrote: > My question then I guess is: how do you do bulk transfers (read and write) > to all 4 interfaces? The method I use on Linux, fails on windows. > > A control transfer is no problem since you effectively specify the > interface, but how do you do a bulk transfer?
Well, libusb_bulk_transfer takes an endpoint as parameter, and as "Endpoints can't be shared between two interfaces within a configuration" [1], specifying an endpoint effectively specifies the interface you want to use as well. > In my linux code (which does work - it's been running for many days doing > I/Os non stop - at least 10 per second each, randomly, to all 4 interfaces) > To setup: > I open a handle then claim the interface 0 (as stated before) > Then I open a second handle and claim interface 1 on the 2nd handle > ('claim' requires a handle) Which doesn't have to be "freshly baked". A libusb device handle shouldn't become invalid as soon as you use it to claim an interface. Have you simply tried reusing that one handle you got from your first libusb_open() in every subsequent call that requires a handle? We've been pretty much been advising you to avoid issuing multiple calls to libusb_open(). Have you tried doing that? > I have 4 threads - each has it's own handle to talk to the interface it > is given. Try a single thread (talking to as many interfaces as you like) using a single handle. See if that works. Then try to share that handle between your 4 threads. I think that, by issuing multiple open from within multiple threads, you may be hitting the "WinUSB does not support multiple concurrent applications" limitation [2] (as I doubt MS will make much distinction between a open from a thread and open from a process). On that note, you may be interested to know that the first libusb_open() call you issue for a libusb device on Windows will try to get an WinUSB handle (which is internal and different from the public libusb handle) for ALL of the interfaces it can access. So really, you shouldn't have to issue open() over and over again. Regards, /Pete [1] http://msdn.microsoft.com/en-us/library/windows/hardware/hh920375%28v=vs.85%29.aspx [2] https://github.com/libusbx/libusbx/wiki/Windows-Backend#wiki-Known_Restrictions ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel