libserial
libserial copied to clipboard
Input/output error
Hello,
I am getting exceptions occasionally on Write(). Here is an exception I am getting.
terminate called after throwing an instance of 'std::runtime_error'
what(): Input/output error
Aborted (core dumped)
here is kernel dmsg. Did you ever encounter this? I have a little LTE module plugged into 2 port USB hub. And sending AT commands on /dev/ttyUSB1. I am not sure if this is a problem with liberalism. I am still investigating
disabled by hub (EMI?), re-enabling...
Cheers
Hi @mrspirytus , are you using a SerialPort or a SerialStream object?
You will get this exception in the following case:
else if (write_result <= 0 && errno != EWOULDBLOCK)
{
throw std::runtime_error(std::strerror(errno)) ;
}
So if the write was unsuccessful and reported back as such by the OS, or if errno is anything but a blocking call you will see this. If you add a try/catch block to your executing code you can capture this exception and continue execution of your application.
Still looking into this...