linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	linux-gpio@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [libgpiod][PATCH 0/5] core: provide information about the parent chip in line requests
Date: Thu, 20 Jul 2023 21:37:21 +0800	[thread overview]
Message-ID: <ZLk4kVrT45dTNSNM@sol> (raw)
In-Reply-To: <CAMRc=Md34kYQ4B8NQo2c+seJTN_24he7J5bwRD8sPy-xJyqkXw@mail.gmail.com>

On Thu, Jul 20, 2023 at 02:30:45PM +0200, Bartosz Golaszewski wrote:
> On Thu, Jul 20, 2023 at 11:52 AM Kent Gibson <warthog618@gmail.com> wrote:
> >
> >
> > The case I was thinking of was wanting to release a line, and if you
> > don't know which request you will have to walk the request objects.
> >
> 
> You cannot release a single line if it's part of a wider request though.
> 

Of course. Unless we were to extend the uAPI to allow that.

> > And what of lines that are requested directly by apps other than the
> > gpio-manager?
> >
> 
> You can tell they're used but cannot request them just like with any
> other user of the cdev.
> 

This is going to be a pain point - the concept of "used" is getting
muddy.

Say two processes want to get a line.
So both need to request it before they can get it?
Or only one does the request and both can get?

The latter case is painful to use.
The former requires request being idempotent or at least to return an
error that distiguishes a line already held by gpio-manager and a line
already held but not by gpio-manager.

> > > >
> > > > Where do edge events fit in there?
> > > >
> > >
> > > It's a signal exposed by the io.gpiod1.Line interface.
> >
> > But separate from the PropertiesChanged?
> >
> 
> Yes. PropertiesChanged is emitted on changes in properties (direction,
> edge, all reported by gpionotify) while EdgeEvent is for edges
> exclusively.
> 
> >
> > I am also wondering if the tools can be extended with the option to
> > perform their ops using the gpio-manager, particularly get/set/mon that
> > currently require exclusive access.
> >
> 
> There's a client app already functional in my WiP branch. Think nmcli
> for NetworkManager. It doesn't link against libgpiod - only uses the
> DBus API.
> 

Sure - doesn't mean other tools can't use the DBus API too.
My thinking was existing users of GPIO tools could just add
an option, say -D, to their scripts to switch over to gpio-manager.

> You can do something like this (not all of this is implemented yet):
> 
> $ # Wait for a chip with a particular label to appear
> $ gpiocli wait --chip="foobar" --timeout=10s
> $ # Request a line for edge events
> $ gpiocli request --input --rising-edge --falling-edge foo
> request0

Will that support multiple lines, possibly spanning multiple chips?

> $ # List available requests
> $ gpiocli requests
> request0 (gpiochip0) offsets: [4]

But that will only return the requests made by gpio-manager, right?

> $ # Wait for edge events:
> $ gpiocli monitor foo
> Offset: 4 RISING EDGE Timestamp: 3425234234
> $ # Release the request
> $ gpiocli release request0
> 
> This way the user can easily use bash scripts, command line or even
> any DBus library out there while we still use the character device in
> the daemon and ditch sysfs.
> 

Agreed.  As covered earlier, access control needs to be fleshed out, but
other than that I don't see any obvious deal breakers.

Cheers,
Kent.

  reply	other threads:[~2023-07-20 13:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-19 19:20 [libgpiod][PATCH 0/5] core: provide information about the parent chip in line requests Bartosz Golaszewski
2023-07-19 19:20 ` [libgpiod][PATCH 1/5] core: provide gpiod_line_request_get_chip_path() Bartosz Golaszewski
2023-07-19 19:20 ` [libgpiod][PATCH 2/5] tests: add a test-case for gpiod_line_request_get_chip_path() Bartosz Golaszewski
2023-07-19 19:20 ` [libgpiod][PATCH 3/5] bindings: cxx: provide line_request::chip_path() Bartosz Golaszewski
2023-07-19 19:20 ` [libgpiod][PATCH 4/5] bindings: python: provide the chip_path property in line_request Bartosz Golaszewski
2023-07-19 19:20 ` [libgpiod][PATCH 5/5] bindings: rust: provide LineRequest::chip_path() Bartosz Golaszewski
2023-07-20  5:04   ` Erik Schilling
2023-07-20  8:04     ` Bartosz Golaszewski
2023-07-20  8:10       ` Erik Schilling
2023-07-20  3:27 ` [libgpiod][PATCH 0/5] core: provide information about the parent chip in line requests Kent Gibson
2023-07-20  7:59   ` Bartosz Golaszewski
2023-07-20  8:05     ` Kent Gibson
2023-07-20  8:25       ` Bartosz Golaszewski
2023-07-20  8:39         ` Kent Gibson
2023-07-20  8:49           ` Bartosz Golaszewski
2023-07-20  9:16             ` Kent Gibson
2023-07-20  9:38               ` Bartosz Golaszewski
2023-07-20  9:52                 ` Kent Gibson
2023-07-20 12:30                   ` Bartosz Golaszewski
2023-07-20 13:37                     ` Kent Gibson [this message]
2023-07-20 15:01                       ` Bartosz Golaszewski
2023-07-21  1:37                         ` Kent Gibson
2023-07-20  8:42     ` Andy Shevchenko

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=ZLk4kVrT45dTNSNM@sol \
    --to=warthog618@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=viresh.kumar@linaro.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).