From af65870244aa80230cdd8c014b39e0304d20b479 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 8 Apr 2013 12:01:16 +1000 Subject: [PATCH] select() on serial usb in avalon does not work properly with zero timeout. --- driver-avalon.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/driver-avalon.c b/driver-avalon.c index 2d1ea9c0..9e54e76b 100644 --- a/driver-avalon.c +++ b/driver-avalon.c @@ -212,13 +212,13 @@ static inline int avalon_gets(int fd, uint8_t *buf, struct thr_info *thr, struct timeval timeout; fd_set rd; + if (unlikely(thr->work_restart)) { + applog(LOG_DEBUG, "Avalon: Work restart"); + return AVA_GETS_RESTART; + } + timeout.tv_sec = 0; - /* If we get a restart message, still check if there's - * anything in the buffer waiting to be parsed */ - if (unlikely(thr->work_restart || !first)) - timeout.tv_usec = 0; - else - timeout.tv_usec = 100000; + timeout.tv_usec = 100000; FD_ZERO(&rd); FD_SET(fd, &rd);