Re: [libgpiod PATCH] gpioget: Add --line-name to lookup GPIO line

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

 



On Wed, 1 Dec 2021 at 08:29, Bartosz Golaszewski <brgl@xxxxxxxx> wrote:
>
> On Wed, Dec 1, 2021 at 8:29 AM Joel Stanley <joel@xxxxxxxxx> wrote:
> >
> > Systems provide line names to make using GPIOs easier for userspace. Use
> > this feature to make the tools user friendly by adding the ability to
> > show the state of a named line.
> >
> >  $ gpioget --line-name power-chassis-good
> >  1
> >
> >  $ gpioget -L pcieslot-power
> >  0

> I'm not very convinced to be honest. It's not like "gpioget gpiochip0
> `gpiofind gpiochip0 line-name`" requires much more typing than
> "gpioget gpiochip --line-name=name".

I'm taking on feedback from people working in our labs, and
implementing userspace applications. We've been building BMCs with
mainline Linux for about six years now, and it's been a long road
re-training them from "back in the day we just did devmem <this>
<that>" and "why can't we just do cat /sys/class/gpio/gpio305/value",
and now "why does the level of the GPIO change back after I run the
command?".

This usability improvement is one more step towards them using and
being happy with the "new world" of the gpiod API.

Once we settle on a good API here, I plan on submitting a version of
gpioget/gpioset added to busybox.

> There are also other questions:
> this uses getopt and only allows to specify a single line name. What
> if we want to specify more lines like with offsets? Even if you allow
> multiple names, getopt() doesn't guarantee ordering of arguments.

If you're happy with the concept I'm happy to iterate on the implementation.

Yes, it only allows a single line name. That tends to be how the tool
is used, both from the command line and in scripts.

Can you give me an example of your proposed command line API, so I can
understand what you're suggesting here?

Cheers,

Joel



[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