* Request an output line, without modifying the value
@ 2021-04-23 15:32 Peter Rosin
2021-04-24 6:21 ` [libgpiod] " Kent Gibson
0 siblings, 1 reply; 3+ messages in thread
From: Peter Rosin @ 2021-04-23 15:32 UTC (permalink / raw)
To: linux-gpio
Hi!
I'm wondering if there is a way to request an output line using
libgpiod without clobbering the previous value. I would like for
an application to take a peek at this previous value of an output
gpio and behave slightly different for 0/1.
Cheers,
Peter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [libgpiod] Request an output line, without modifying the value
2021-04-23 15:32 Request an output line, without modifying the value Peter Rosin
@ 2021-04-24 6:21 ` Kent Gibson
2021-04-26 4:34 ` Peter Rosin
0 siblings, 1 reply; 3+ messages in thread
From: Kent Gibson @ 2021-04-24 6:21 UTC (permalink / raw)
To: Peter Rosin; +Cc: linux-gpio
On Fri, Apr 23, 2021 at 05:32:15PM +0200, Peter Rosin wrote:
> Hi!
>
> I'm wondering if there is a way to request an output line using
> libgpiod without clobbering the previous value. I would like for
> an application to take a peek at this previous value of an output
> gpio and behave slightly different for 0/1.
>
> Cheers,
> Peter
Assuming it is still an output then GPIOD_LINE_REQUEST_DIRECTION_AS_IS
should do what you are after.
But there is no guarantee that the line state is preserved across
requests, so YMMV.
Cheers,
Kent.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [libgpiod] Request an output line, without modifying the value
2021-04-24 6:21 ` [libgpiod] " Kent Gibson
@ 2021-04-26 4:34 ` Peter Rosin
0 siblings, 0 replies; 3+ messages in thread
From: Peter Rosin @ 2021-04-26 4:34 UTC (permalink / raw)
To: Kent Gibson; +Cc: linux-gpio
On 2021-04-24 08:21, Kent Gibson wrote:
> On Fri, Apr 23, 2021 at 05:32:15PM +0200, Peter Rosin wrote:
>> Hi!
>>
>> I'm wondering if there is a way to request an output line using
>> libgpiod without clobbering the previous value. I would like for
>> an application to take a peek at this previous value of an output
>> gpio and behave slightly different for 0/1.
>>
>> Cheers,
>> Peter
>
> Assuming it is still an output then GPIOD_LINE_REQUEST_DIRECTION_AS_IS
> should do what you are after.
> But there is no guarantee that the line state is preserved across
> requests, so YMMV.
Excellent suggestion, I'll try that. And now I of course feel silly for
not seeing it myself, it's so obvious...
Thanks a bunch!
Cheers,
Peter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-26 4:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 15:32 Request an output line, without modifying the value Peter Rosin
2021-04-24 6:21 ` [libgpiod] " Kent Gibson
2021-04-26 4:34 ` Peter Rosin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.