serial-port icon indicating copy to clipboard operation
serial-port copied to clipboard

"serialstream << " timeout

Open StefanGu65 opened this issue 5 years ago • 1 comments

Hello!

This looks like a great starting point for my needs, any chance you can add a timeout on the write operation as well? If the (e.g. USB) device goes away or locks up for some reason, I need a timeout and abort the port, go look for it again (using e.g. udev) and restart the process if/when it comes back online. Also, a flush of the input could be handy if there is some old garbage hanging around. This would be typical for say, a modem.

I could technically add this myself using your excellent code as a starting point, but I find that the long term maintenance is better if not forking...

BR,

Stefan

StefanGu65 avatar May 05 '19 15:05 StefanGu65

Are you sure write could block indefinitely? If the USB device goes away write I believe write will return an exception. Can you provide a quick example code to reproduce this condition?

fedetft avatar May 12 '19 21:05 fedetft