gpiomon: correctly handle poll timeouts
authorBartosz Golaszewski <bartekgola@gmail.com>
Fri, 29 Sep 2017 13:31:12 +0000 (15:31 +0200)
committerBartosz Golaszewski <bartekgola@gmail.com>
Fri, 29 Sep 2017 13:31:12 +0000 (15:31 +0200)
We don't check for timeout events in the simple loop event handler.

Fix it and return a correct value.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
src/tools/gpiomon.c

index 533d57870ad62780e8a3bac903c0299a538ff337..cabbcedea67727ee51aa36c055a7e8c737850ce1 100644 (file)
@@ -186,6 +186,9 @@ static int event_callback(int event_type, unsigned int line_offset,
 {
        struct mon_ctx *ctx = data;
 
+       if (event_type == GPIOD_SIMPLE_EVENT_CB_TIMEOUT)
+               return GPIOD_SIMPLE_EVENT_CB_RET_OK;
+
        if (!ctx->silent) {
                if ((event_type == GPIOD_SIMPLE_EVENT_CB_RISING_EDGE
                    && ctx->watch_rising)