summaryrefslogtreecommitdiff
path: root/events.c
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2018-05-21 23:45:15 +0800
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2018-05-21 21:24:53 +0300
commit545bf1d043af1e79650666f5785cf6e7d413c4e7 (patch)
tree9ebedd59e92f59e2baa31ac4bf7341d4fcbfd0df /events.c
parent262fce3f7d37646e2d8937a20e2967bbf3c167cf (diff)
events: Remove select timeout
The reason why no timeout is needed is twofold: When the stream is off extensive periods of time can pass without an event occurring if the host doesn't send any UVC request. As that period of time is unbound, we can't set any meaningful timeout. When the stream is on buffers are supposed to flow constantly. If buffers stop flowing that would indicate a bug somewhere in the stack, which could be caught by a timeout, but that we wouldn't be able to recover from anyway. The timeout is thus not needed and harmful when the stream is off. Remove it. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'events.c')
-rw-r--r--events.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/events.c b/events.c
index cc6c6cd..6840c19 100644
--- a/events.c
+++ b/events.c
@@ -128,19 +128,16 @@ bool events_loop(struct events *events)
events->done = false;
while (!events->done) {
- struct timeval timeout;
fd_set rfds;
fd_set wfds;
fd_set efds;
int ret;
- timeout.tv_sec = SELECT_TIMEOUT / 1000;
- timeout.tv_usec = (SELECT_TIMEOUT % 1000) * 1000;
rfds = events->rfds;
wfds = events->wfds;
efds = events->efds;
- ret = select(events->maxfd + 1, &rfds, &wfds, &efds, &timeout);
+ ret = select(events->maxfd + 1, &rfds, &wfds, &efds, NULL);
if (ret < 0) {
/* EINTR means that a signal has been received, continue
* to the next iteration in that case.
@@ -151,14 +148,6 @@ bool events_loop(struct events *events)
printf("error: select failed with %d\n", errno);
break;
}
- if (ret == 0) {
- /* select() should never time out as the ISP is supposed
- * to capture images continuously. A timeout is thus
- * considered as a fatal error.
- */
- printf("error: select timeout\n");
- break;
- }
events_dispatch(events, &rfds, &wfds, &efds);
}