śr., 31 lip 2019 o 09:48 Ramon Fried <rfried.dev@xxxxxxxxx> napisał(a): > > On Wed, Jul 31, 2019 at 10:44 AM Bartosz Golaszewski > <bgolaszewski@xxxxxxxxxxxx> wrote: > > > > wt., 30 lip 2019 o 21:04 Ramon Fried <rfried.dev@xxxxxxxxx> napisał(a): > > > > > > In case where the GPIOLINE_FLAG_KERNEL flag was set because of muxing, > > > The used column was still showing the pin as "unused" > > > Fix that by writing "used". > > > > > > Signed-off-by: Ramon Fried <rfried.dev@xxxxxxxxx> > > > --- > > > tools/gpioinfo.c | 7 +++++-- > > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > > > diff --git a/tools/gpioinfo.c b/tools/gpioinfo.c > > > index bb17262..85f8758 100644 > > > --- a/tools/gpioinfo.c > > > +++ b/tools/gpioinfo.c > > > @@ -119,8 +119,11 @@ 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) && !consumer) > > > + prinfo(&of, 12, "used"); > > > + else > > > + consumer ? prinfo(&of, 12, "\"%s\"", consumer) > > > + : prinfo(&of, 12, "unused"); > > > printf(" "); > > > > > > prinfo(&of, 8, "%s ", direction == GPIOD_LINE_DIRECTION_INPUT > > > -- > > > 2.22.0 > > > > > > > Good catch! I think we can make it even more readable by first calling > > gpiod_line_is_used() and printing 'unused' if it returns false and > > then checking the consumer string. > OK, I'll send v2. > Thanks, > Ramon. > > > > Bart Cool, I'm also thinking that we need to distinguish somehow regular consumer strings from lines used by kernel. Maybe a string like '[kernel]' instead of 'used' would be nice? Bart