From: Domien N. <dom...@gm...> - 2011-09-03 22:52:39
|
Also, I'd like to add to my previous post that I am using bulk transfers with a timeout of 0. > Hello all, > > I'm using the windows backend of libusb1.0, with the WinUSB driver, > and I'm trying to get better performance by submitting multiple bulk > transfers at once. > My USB device is currently setup to send 4x512-byte packets and a > single 256-byte packet at once (and in that order) to the host, > followed by a delay of a second, and then followed by a single > 512-byte packet. > > On the host, I have submitted 16 asynchronous transfers at once, each > with a buffer capacity of 256K. Now my observations are as follows: > I get one transfer callback with an actual_length of 2304 bytes, > followed by... nothing. My app just keeps idling and waiting for more > packets since it keeps printing a "Tick" message to the screen every > 100ms after handling libusb events. No errors are reported by libusb > whatsoever. > > My USB device also reports it has succesfully sent 2816 bytes, and for > those still listening it means that last 512-byte packet has gone into > limbo on the host as far as libusb (or WinUSB) is concerned. > And, when I repeat the same test with a *synchronous* read, then > libusb returns successfully with *all* 2816 bytes. Pretty weird. > > So my question, is this the proper behavior of libusb? > I was under the impression that the buffer length passed in the libusb > transfer was a maximum buffer size, and anything received smaller than > that will get passed back to the application too. > I'd like to know how I can get that last 512-byte packet out with > libusb through asychronous transfers. > > Thanks in advance. > Domien Nowicki. > |