Non-blocking mode does not work on some Linuxes
Brought to you by:
msiennicki
Using
fcntl(serial->fd,F_SETFL,O_ASYNC|O_NONBLOCK)
will fail because the subsequent read() call after obtaining the signal will return the error EAGAIN ("resource temporarily unavailable"). This translates to invoking read on a descriptor marked with O_NONBLOCK. Replacing the above line with
fcntl(serial->fd,F_SETFL,O_ASYNC)
should solve this issue.