linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Leszek Dubiel <leszek@dubiel.pl>
Cc: linux-gpio@vger.kernel.org
Subject: Re: Elegant way to kill previous gpioset?
Date: Wed, 16 Nov 2022 19:52:07 +0800	[thread overview]
Message-ID: <Y3TO52Fn3XIqN8yY@sol> (raw)
In-Reply-To: <1608e9ad-d9c4-8856-569f-cd894ffc2836@dubiel.pl>

On Wed, Nov 16, 2022 at 09:54:21AM +0100, Leszek Dubiel wrote:
> 
> 
> I was wondering if there is some "one-liner" that
> recofigures pin, something like:
> 
>                 gpioset -b -msignal --autokill /dev/gpiochip2 7=0
> 
> or
>                 gpioset -b -msignal --force /dev/gpiochip2 7=0
> 
> that does these two commands at once:
> 
>               pkill -ef "^gpioset .* /dev/gpiochip2 7=[01]$"
>               gpioset -b -msignal /dev/gpiochip2 7=0
> 
> 

Understand that GPIOs are a managed resource, like files, and what
you are asking for here is equivalent to a function that would kill
whatever process has a file open whenever you write to that file.
So, no there isn't.

It is really unfortunate that killing the process holding the line is the
only viable approach when using the libgpiod tools at the moment, but
better solutions to your problem should be available soon.
Alternatively you can use, say, the Python bindings to write something
that better suits your particular needs.

Cheers.
Kent.

      reply	other threads:[~2022-11-16 12:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fc3da423-1107-83a1-1c94-afb2ac5fa7c9@dubielvitrum.pl>
2022-11-15 20:01 ` User space tools Leszek Dubiel
2022-11-15 20:36 ` Elegant way to kill previous gpioset? Leszek Dubiel
2022-11-16  5:52   ` Kent Gibson
2022-11-16  8:54     ` Leszek Dubiel
2022-11-16 11:52       ` Kent Gibson [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=Y3TO52Fn3XIqN8yY@sol \
    --to=warthog618@gmail.com \
    --cc=leszek@dubiel.pl \
    --cc=linux-gpio@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).