core: really fix event requests
authorBartosz Golaszewski <bartekgola@gmail.com>
Mon, 6 Feb 2017 11:34:34 +0000 (12:34 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Mon, 6 Feb 2017 11:35:39 +0000 (12:35 +0100)
The previous commit addressing the issue when requesting both types
of line events was braindead. Actually fix the bug this time: check
the event_type, not the eventflags.

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

index f5beeb769ab7062db64e5fd217c282d8de3ca034..aa8f6a835edc490e736d4ec04fb767f365b29251 100644 (file)
@@ -774,7 +774,7 @@ int gpiod_line_event_request(struct gpiod_line *line,
                req->eventflags |= GPIOEVENT_EVENT_RISING_EDGE;
        else if (config->event_type == GPIOD_EVENT_FALLING_EDGE)
                req->eventflags |= GPIOEVENT_EVENT_FALLING_EDGE;
-       else if (req->eventflags == GPIOD_EVENT_BOTH_EDGES)
+       else if (config->event_type == GPIOD_EVENT_BOTH_EDGES)
                req->eventflags |= GPIOEVENT_REQUEST_BOTH_EDGES;
 
        chip = gpiod_line_get_chip(line);