From c8437f94d3515d32a837f376cecd521eee268836 Mon Sep 17 00:00:00 2001 From: Ramon Fried Date: Wed, 31 Jul 2019 20:38:14 +0300 Subject: [PATCH] gpioinfo: mark kernel claimed lines as used In case where the GPIOLINE_FLAG_KERNEL flag was set and no consumer string is provided by the kernel, the used column was still showing the pin as "unused" Fix that by writing "kernel". Signed-off-by: Ramon Fried [Bartosz: - fixed indentation and alignment - tweaked the commit message formatting] Signed-off-by: Bartosz Golaszewski --- tools/gpioinfo.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/gpioinfo.c b/tools/gpioinfo.c index bb17262..8a1d00d 100644 --- a/tools/gpioinfo.c +++ b/tools/gpioinfo.c @@ -119,8 +119,12 @@ static void list_lines(struct gpiod_chip *chip) : prinfo(&of, 12, "unnamed"); printf(" "); - consumer ? prinfo(&of, 12, "\"%s\"", consumer) - : prinfo(&of, 12, "unused"); + if (!gpiod_line_is_used(line)) + prinfo(&of, 12, "unused"); + else + consumer ? prinfo(&of, 12, "\"%s\"", consumer) + : prinfo(&of, 12, "kernel"); + printf(" "); prinfo(&of, 8, "%s ", direction == GPIOD_LINE_DIRECTION_INPUT -- 2.30.2