From 7c75363af8c9a56f6a4ec028359c8c126dae673e Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Sun, 24 Sep 2017 21:11:45 +0200 Subject: [PATCH] simple: fix the active_low switch in gpiod_simple_event_loop() We're incorrectly passing the boolean active_low argument to gpiod_line_request_both_edges_events_flags() as flags. Add the same conversion as in the other simple API routines. Signed-off-by: Bartosz Golaszewski --- src/lib/simple.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/simple.c b/src/lib/simple.c index c141f7b..2b23e4b 100644 --- a/src/lib/simple.c +++ b/src/lib/simple.c @@ -142,9 +142,9 @@ int gpiod_simple_event_loop(const char *consumer, const char *device, gpiod_event_cb callback, void *cbdata) { struct gpiod_line_event event; + int status, evtype, flags; struct gpiod_chip *chip; struct gpiod_line *line; - int status, evtype; chip = gpiod_chip_open_lookup(device); if (!chip) @@ -156,8 +156,10 @@ int gpiod_simple_event_loop(const char *consumer, const char *device, return -1; } + flags = active_low ? GPIOD_REQUEST_ACTIVE_LOW : 0; + status = gpiod_line_request_both_edges_events_flags(line, consumer, - active_low); + flags); if (status < 0) { gpiod_chip_close(chip); return -1; -- 2.30.2