From 400f3f6da6f45587fd9d2d0f1d319445f33cb8ae Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Mon, 2 Jan 2017 15:49:31 +0100 Subject: [PATCH] core: fix a default value bug when requesting a GPIO line The direction is stored in the 'direction' argument, not in flags. Signed-off-by: Bartosz Golaszewski --- core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core.c b/core.c index 1a4f8f5..5e4914c 100644 --- a/core.c +++ b/core.c @@ -217,9 +217,9 @@ int gpiod_line_request(struct gpiod_line *line, const char *consumer, req->lineoffsets[0] = line->info.line_offset; req->lines = 1; - /* FIXME This doesn't seem to work... */ - if (flags & GPIOD_DIRECTION_OUT) - req->default_values[0] = default_val ? 1 : 0; + + if (direction == GPIOD_DIRECTION_OUT) + req->default_values[0] = (__u8)default_val; strncpy(req->consumer_label, consumer, sizeof(req->consumer_label) - 1); -- 2.30.2