summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/iobuf.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/iobuf.c b/src/iobuf.c
index 6d238ec..83e531a 100644
--- a/src/iobuf.c
+++ b/src/iobuf.c
@@ -28,6 +28,18 @@
28 28
29#include "iobuf.h" 29#include "iobuf.h"
30#include "state.h" 30#include "state.h"
31#include <poll.h>
32
33int mtdev_idle(struct mtdev *dev, int fd, int ms)
34{
35 struct mtdev_state *state = dev->state;
36 struct mtdev_iobuf *buf = &state->iobuf;
37 struct pollfd fds = { fd, POLLIN, 0 };
38 return evbuf_empty(&state->outbuf) &&
39 evbuf_empty(&state->inbuf) &&
40 buf->head == buf->tail &&
41 poll(&fds, 1, ms) <= 0;
42}
31 43
32int mtdev_fetch(struct mtdev *dev, struct input_event *ev, int fd) 44int mtdev_fetch(struct mtdev *dev, struct input_event *ev, int fd)
33{ 45{