Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Peter Rosin <peda@axentia.se>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: [libgpiod] Request an output line, without modifying the value
Date: Sat, 24 Apr 2021 14:21:32 +0800	[thread overview]
Message-ID: <20210424062132.GA14885@sol> (raw)
In-Reply-To: <6e26b4e5-277b-459f-29e7-7eb7e949e6a5@axentia.se>

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.

  reply	other threads:[~2021-04-24  6:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23 15:32 Request an output line, without modifying the value Peter Rosin
2021-04-24  6:21 ` Kent Gibson [this message]
2021-04-26  4:34   ` [libgpiod] " Peter Rosin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210424062132.GA14885@sol \
    --to=warthog618@gmail.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=peda@axentia.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox