2013/12/20 Anguel Stankov <ang...@gmx.net>:
> Hi!
>
> I have also posted my question in the libusb list but got no reply so far,
> so I try my luck here. I hope that there are more experts reading here. My
> question is whether submitting multiple transfers in parallel and handling
> the results (by checking in the callback function which of the transfers
> actually called back during "handle events") is possible in libusbx?
>
> In particular, I am trying to mix multiple transfers using the asynch
> interface like this:
>
> 1. On EP1 I have a periodic bulk IN transfer which I submit and after 1 s I
> call "handle events" to fetch its results. Then I resubmit this transfer and
> so on. This works fine so far.

So you're calling "handle events" based on your assumption about when
to call it here?

> 2. I submit a bulk OUT transfer on EP2 to tell my USB device to start
> sending some larger amount of data to the host. This data is then fetched by
> another bulk IN transfer on EP3. This also work fine when used without the
> periodic transfer described in 1.
>
> The problem: Unfortunately, if the periodic transfer described in 1. is
> running, as soon as I submit a bulk OUT on EP2 as described in 2., this
> pending periodic bulk IN on EP1 never calls back. It seems to "disappear"
> somehow. Is this expected?

Are you doing the same for the "handle events" calling here as in the
first case? Maybe your assumption about when to call it don't work out
anymore when your combine the two?

I have a libusb based application that keeps 5 bulk IN transfers
submitted on a single endpoint to read data and I use bulk OUT
transfers to send commands to the device. I'm using the poll based
approach for event handling with libusb. So libusb is basically
telling my when to call "handle events" instead of me guessing when to
call it. This works without any problems.

Maybe you need to do something similar for event handling and remove
the assumptions about when to call "handle events". You can also just
use a dedicated thread to constantly call "handle events" to get rid
of the guessing. I didn't use an extra thread because I already had a
poll based event loop in my application.

-- 
Matthias Bolte
http://photron.blogspot.com

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to