From: Bartosz Golaszewski Date: Mon, 2 Jan 2017 14:49:31 +0000 (+0100) Subject: core: fix a default value bug when requesting a GPIO line X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=400f3f6da6f45587fd9d2d0f1d319445f33cb8ae;p=qemu-gpiodev%2Flibgpiod.git 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 --- 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);