All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Rosin <peda@axentia.se>
To: Kent Gibson <warthog618@gmail.com>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: [libgpiod] Request an output line, without modifying the value
Date: Mon, 26 Apr 2021 06:34:12 +0200	[thread overview]
Message-ID: <ba9021bc-6558-910b-47ce-c2effb821fee@axentia.se> (raw)
In-Reply-To: <20210424062132.GA14885@sol>

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

      reply	other threads:[~2021-04-26  4:34 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 ` [libgpiod] " Kent Gibson
2021-04-26  4:34   ` Peter Rosin [this message]

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=ba9021bc-6558-910b-47ce-c2effb821fee@axentia.se \
    --to=peda@axentia.se \
    --cc=linux-gpio@vger.kernel.org \
    --cc=warthog618@gmail.com \
    /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 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.