Closed ThreeMileJump closed 4 years ago
I will look into recreating this locally. I would expect the underlying read() to fail with a EIO.
Thanks for reporting. Fixed in c-periphery v2.0.1 / lua-periphery v2.0.1.
This condition will return an error of SERIAL_ERROR_IO
with the message Reading serial port: unexpected empty read
.
If I attempt a read on the serial device with a timeout set, after pulling out the USB cable, then the read hangs. If the USB cable has been pulled out, then the serial port should have closed and read should give an error, or at least time out and return no data.
The problem here is that closing the USB serial device seems to result in a hang that can only be fixed by closing the program. USB port closing down needs to be detectable so the user can do something about it.
Under linux, a brief USB disconnect will move the device to the next COM port - which is hard to detect and fix without error messages.