Re: [libgpiod] [PATCH] gpioinfo: mark kernel claimed lines as used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Bart




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux