colead-slm: Mark serial read calls as nonblocking.

This is an odd one. These calls are made from a receive handler so should not
block, and appear to be setup correctly to handle partial reads or no data
available. However, the driver was not opening the port with SERIAL_NONBLOCK
so these calls would have been blocking. Make them nonblocking.
This commit is contained in:
Martin Ling 2014-09-21 17:54:18 +01:00 committed by Uwe Hermann
parent 258a23134d
commit c9fc06d7f0
1 changed files with 2 additions and 2 deletions

View File

@ -201,7 +201,7 @@ SR_PRIV int colead_slm_receive_data(int fd, int revents, void *cb_data)
serial = sdi->conn;
if (devc->state == IDLE) {
if (serial_read(serial, buf, 128) != 1 || buf[0] != 0x10)
if (serial_read_nonblocking(serial, buf, 128) != 1 || buf[0] != 0x10)
/* Nothing there, or caught the tail end of a previous packet,
* or some garbage. Unless it's a single "data ready" byte,
* we don't want it. */
@ -214,7 +214,7 @@ SR_PRIV int colead_slm_receive_data(int fd, int revents, void *cb_data)
devc->buflen = 0;
}
} else {
len = serial_read(serial, devc->buf + devc->buflen,
len = serial_read_nonblocking(serial, devc->buf + devc->buflen,
10 - devc->buflen);
if (len < 1)
return TRUE;