* How to set GPIOs persistently high with libgpiod
@ 2024-07-10 22:36 Akash Borde
2024-07-11 1:44 ` Kent Gibson
0 siblings, 1 reply; 2+ messages in thread
From: Akash Borde @ 2024-07-10 22:36 UTC (permalink / raw)
To: Akash Borde; +Cc: linux-gpio@vger.kernel.org, Seth Drew
Hi!
I wanted to look for a way that we can set output values for gpios using Linux’s libgpiod library such that we can write a value to a (chip,pin) combo and be able to read the value we wrote from that same pin.
For example,
heila@device# gpioset gpiochip4 29=1 ### Sets GPIO Output Pin to 1
heila@device# gpioget gpiochip4 29 0 ### Reads a 0 at the same Output Pin
Happy to provide more details on our hardware/product/application if that’s needed as well.
I’m not sure if this email address is monitored, please let me know if there is another one I should reach out to.
https://manpages.debian.org/testing/gpiod/gpioset.1.en.html I found the email at the bottom of this manpage.
Thanks,
Akash Borde
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to set GPIOs persistently high with libgpiod
2024-07-10 22:36 How to set GPIOs persistently high with libgpiod Akash Borde
@ 2024-07-11 1:44 ` Kent Gibson
0 siblings, 0 replies; 2+ messages in thread
From: Kent Gibson @ 2024-07-11 1:44 UTC (permalink / raw)
To: Akash Borde; +Cc: linux-gpio@vger.kernel.org, Seth Drew
On Wed, Jul 10, 2024 at 10:36:08PM +0000, Akash Borde wrote:
> Hi!
>
> I wanted to look for a way that we can set output values for gpios using Linux’s libgpiod library such that we can write a value to a (chip,pin) combo and be able to read the value we wrote from that same pin.
>
> For example,
>
> heila@device# gpioset gpiochip4 29=1 ### Sets GPIO Output Pin to 1
> heila@device# gpioget gpiochip4 29 0 ### Reads a 0 at the same Output Pin
>
There is no way to do that with the libgpiod v1 tools that you are using.
It can be done with the library directly, but you need to write some code.
With the libgpiod v2 tools there is a --as-is option on gpioget that
does not switch the line to an input and so can read back the output value.
Note though that the value of an output AFTER gpioset exits depends on
the device driver, so it may get reset to its default value. YMMV.
And there is a gpio-manager daemon in development that would provide a
solution independent of the driver.
> Happy to provide more details on our hardware/product/application if that’s needed as well.
>
Generally speaking you shouldn't use GPIO outputs as a persistent store.
Have a process manage the line.
> I’m not sure if this email address is monitored, please let me know if there is another one I should reach out to.
> https://manpages.debian.org/testing/gpiod/gpioset.1.en.html I found the email at the bottom of this manpage.
>
That email address is correct, though it would be helpful to prefix the
subject with [libgpiod], as per the CONTRIBUTING section of the README[1],
as the list also serves other purposes.
Cheers,
Kent.
[1] https://github.com/brgl/libgpiod
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-11 1:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-10 22:36 How to set GPIOs persistently high with libgpiod Akash Borde
2024-07-11 1:44 ` Kent Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).