-
Hi, I have a USB device that I can control from host, writing/reading to and from it. No issue with that.
Obviously, i looked at docs and so, perhaps missed a key point, but could not find an answer. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi again, Yesterday evening I did some basic tests. Idea is : By default, dev_reader will be active. From main thread, when a host to dev exchange will be done : stop dev_reader. Check/wait for dev_data to be stopped (with watchdog timeout). Then do the exchange host->dev. As exchange done, restart dev_reader Thread.Should restart dev_data. This should avoid any useful traffic loss or data mangling (from few tests done so far). So, do you see any key points I missed or hided issues I could hit ? If not, I will let you know about result, so it could eventually help others. |
Beta Was this translation helpful? Give feedback.
As committed I confirm previous did the thing.
Due to limitations in python multi-threading, I had to implement an in-class pause/resume/stop mechanism through Event instances. (discovering python for something else than just basic scripting + total newbie vs. USB... Cool.)
Also, setting read timeout to 0 was not good option. Just catch timeout error and pass, check events, and act accordingly.
Don't forget to flush input streams between two cmd in/out thread switches for coherency when the paused will be waken up.
Then it works pretty well.