You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many other similar libraries (like serialport) implement a way to clone or try_clone the handle. This allows one to implement things like two seperate threads, one (blocking on) reading and one writing. I cannot figure out how one would do something like this here.
The text was updated successfully, but these errors were encountered:
I experimented with this a bit. Turns out cloning it anyway gives rather undesirable (or undefined?) behavior. I have experimented with giving one instance to one thread which would try to read and the other instance to another thread which would try to write. The operations are not independent of each other. So if one thread blocks waiting for something to read, the other thread cannot write and just keeps waiting until the other thread is done with its read operation. This was observed on Windows.
I do not know if this is an inherent restriction, or something the Ftdi library artificially imposes to ease up its internal workings.
At the signalling level, USB2 is half duplex meaning that devices are physically prevented from transmitting and receiving at the same time. So FTDI would have no reason to implement such an abstraction in their raw C library.
It's almost definitely not difficult to add a small threaded rust wrapper on top of libftd2xx, but I think that's probably best suited to be a base part of some new library that implements concepts like transactions or channels.
Sorry for rapid fire issues.
Many other similar libraries (like
serialport
) implement a way to clone ortry_clone
the handle. This allows one to implement things like two seperate threads, one (blocking on) reading and one writing. I cannot figure out how one would do something like this here.The text was updated successfully, but these errors were encountered: