Michel Pelletier wrote:
I'm expecting that there will be no reliable
correlation.
TL;DR: That's correct. You'll always have some tens of ms of jitter.
My working
theory is that each process calls into libusb_handle_events_timeout
according to its own process schedule and that there is no way to
coordinate these two calls to happen closely enough in time for the
transfers to happen in a more synchronized fashion.
That's also correct. This is not a function of host software.
Threads do not appear to be any better solution to the
problem.
There isn't.
I'm not an expert in usb transfers, or libusb
I do know USB and libusb and the key in this case is how bulk
transfers are scheduled on the bus - namely optimized for throughput.
Bulk transfers fill whatever bus time is free up to the maximum
throughput the device can handle.
And even if we imagine that you could have two host controllers with
a synchronized schedule (not possible without rewriting the kernel
USB stack) you still don't know what happens inside the USB device,
there is no guarantee that it doesn't introduce jitter too.
USB is not a low latency synchronized interconnect, it is optimized
for throughput.
Reliable scheduling over USB *is* possible, but not using bulk and
not with too high throughput.
//Peter