Re: [PATCH libgpiod 1/2] tools: gpioinfo: don't implicity unquote unnamed lines

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

 



On Fri, Mar 21, 2025 at 12:05:24PM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
>
> Consider the following output of `gpioinfo`:
>
> gpiochip1 - 2 lines:
>         line   0:       "foo"                   output
>         line   1:       unnamed                 output
>
> Now let's run:
>
>     gpioset --chip=gpiochip1 0=active 1=active
>
> The output of `gpioinfo --unquoted` is correct:
>
> gpiochip1 - 2 lines:
>         line   0:       foo                     output consumer=gpioset
>         line   1:       unnamed                 output consumer=gpioset
>
> However, without the `unquoted` switch, it's inconsistent:
>
> gpiochip1 - 2 lines:
>         line   0:       "foo"                   output consumer="gpioset"
>         line   1:       unnamed                 output consumer=gpioset
>
> This is because gpioinfo drops the quotes for all subsequent attribute
> strings when it encounters an unnamed line. We should instead keep a
> separate instance of the `unquoted` flag just for the line name and pass
> the original value of `unquoted_strings` down to
> print_line_attributes().
>

Oh nuts, originally the consumer was a separate field, so the line name
was the only string in the info.
I didn't consider that when making the consumer an attribute :(.

The fix and test look good to me.

Reviewed-by: Kent Gibson <warthog618@xxxxxxxxx>

Cheers,
Kent.




[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