All of lore.kernel.org
 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: Fri, 21 Jul 2023 09:37:48 +0800	[thread overview]
Message-ID: <ZLnhbENoYDmnN2j3@sol> (raw)
In-Reply-To: <CAMRc=Meu9X-1hE=tPzCUfo1QeyHSR=qxWzN++FKTHnzn=1HrBQ@mail.gmail.com>

On Thu, Jul 20, 2023 at 05:01:09PM +0200, Bartosz Golaszewski wrote:
> On Thu, Jul 20, 2023 at 3:37 PM Kent Gibson <warthog618@gmail.com> wrote:
> >
> > 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?
> 
> I think I badly worded the previous answer. The GPIO manager has no
> notion of a user. It just receives a message from the bus. It's the
> daemon that filters the users (e.g. only users in "gpio" group can
> request and set/get GPIOs). So the answer is: one user can in fact
> request a line, it stays requested by the manager and then another
> user can set it or even release it as long as it's got the permissions
> to do so. This is similar to how sysfs works.
> 

Sure.  The point I was trying to make is how does the user determine if
they can release the line via gpio-manager?  Currently they have to walk
the requests looking for the line - and they might not find it.

This is only a minor pain point - in practice the processes will most
likely all be using gpio-manager.

> >
> > 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.
> >
> 
> This should be fine. The manager knows if it's the one controlling a
> line. It's just a matter of distinct error codes.
> 
> > > > > >
> > > > > > 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.
> >
> 
> The functionality of the DBus API doesn't have a full overlap with
> using the library. I don't see why we would want to do this. It would
> introduce a lot of overhead for no reason. I think a separate client
> that doesn't use any libgpiod APIs at all is what's needed.
> 

Fair enough. That works for me.

> > > 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?
> 
> Multiple lines, sure. Spanning multiple chips: I don't think so. Why
> would we need this?
> 

There is no need - the user can make multiple requests as they are now
persistant.  Just wondering what the API looks like to the user.

Cheers,
Kent.

  reply	other threads:[~2023-07-21  1:38 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
2023-07-20 15:01                       ` Bartosz Golaszewski
2023-07-21  1:37                         ` Kent Gibson [this message]
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=ZLnhbENoYDmnN2j3@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 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.