From 4a0eda2b701d4ef26dc3f58f4ff00bbbbb21b246 Mon Sep 17 00:00:00 2001 From: Martin Ling Date: Sun, 21 Sep 2014 18:36:00 +0100 Subject: [PATCH] gmc-mh-1x-2x: Mark serial read calls as nonblocking. These calls were already nonblocking since the driver opens the port with the SERIAL_NONBLOCK flag. They only read one byte. A return value of zero is not handled, but should not occur in theory due to the G_IO_IN check. It might be good to add handling of a zero return anyway, since I'm not sure if this is always accurate. --- src/hardware/gmc-mh-1x-2x/protocol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hardware/gmc-mh-1x-2x/protocol.c b/src/hardware/gmc-mh-1x-2x/protocol.c index 06cae38b..e6de8d52 100644 --- a/src/hardware/gmc-mh-1x-2x/protocol.c +++ b/src/hardware/gmc-mh-1x-2x/protocol.c @@ -1107,7 +1107,7 @@ SR_PRIV int gmc_mh_1x_2x_receive_data(int fd, int revents, void *cb_data) if (revents == G_IO_IN) { /* Serial data arrived. */ while (GMC_BUFSIZE - devc->buflen - 1 > 0) { - len = serial_read(serial, devc->buf + devc->buflen, 1); + len = serial_read_nonblocking(serial, devc->buf + devc->buflen, 1); if (len < 1) break; buf = *(devc->buf + devc->buflen); @@ -1201,7 +1201,7 @@ SR_PRIV int gmc_mh_2x_receive_data(int fd, int revents, void *cb_data) if (revents == G_IO_IN) { /* Serial data arrived. */ while (GMC_BUFSIZE - devc->buflen - 1 > 0) { - len = serial_read(serial, devc->buf + devc->buflen, 1); + len = serial_read_nonblocking(serial, devc->buf + devc->buflen, 1); if (len < 1) break; buf = *(devc->buf + devc->buflen);