Linux-GPIO Archive mirror
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: "Gunnar Thörnqvist" <gunnar@igl.se>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	linux-gpio@vger.kernel.org,
	"Bartosz Golaszewski" <bartosz.golaszewski@linaro.org>
Subject: Re: [libgpiod][PATCH 2/2] tools: allow longer time periods
Date: Wed, 10 Apr 2024 18:19:38 +0800	[thread overview]
Message-ID: <20240410101938.GA68412@rigel> (raw)
In-Reply-To: <CAMRc=Mem+PaLK+CyWXf3z47U1R4myZxFH5TEj3rmTyqOqHXYSA@mail.gmail.com>

On Wed, Apr 10, 2024 at 09:53:49AM +0200, Bartosz Golaszewski wrote:
> On Wed, Apr 10, 2024 at 1:37 AM Kent Gibson <warthog618@gmail.com> wrote:
> >
> > On Tue, Apr 09, 2024 at 07:24:43PM +0200, Bartosz Golaszewski wrote:
> > > On Tue, Apr 9, 2024 at 6:05 PM Kent Gibson <warthog618@gmail.com> wrote:
> > > >
> > > > On Tue, Apr 09, 2024 at 04:58:52PM +0200, Gunnar Thörnqvist wrote:
> > > > > Hi, Got a use case where a hold period is measured in more than seconds?
> > > > > Specifically for a get.:::
> > > > >
> > > > > I can see a large number of use cases where the time can be hours, days and
> > > > > weeks. In my case, pin 17 controls a relay that heats water when electricity
> > > > > is cheapest. It is ok to only have seconds as unit but the range must be
> > > > > larger. /Gunnar
> > > > >
> > > >
> > > > I was asking specifically about the case for gpioget, where a long hold
> > > > period makes absolutely no sense.
> > > >
> > >
> > > One could argue that this option doesn't make sense at all for gpioget. :)
> > >
> >
> > And one would be wrong.  The point of the hold period for gets is to
> > allow the line to settle after a config change before the get itself is
> > performed.
> >
>
> One is indeed wrong.
>
> > > I don't think it hurts to support a longer period of time even if only
> > > for code reuse and less surface for bugs.
> > >
> >
> > Well that is a complicated bit of code.
> >
>
> I'll submit the daemon RFC tomorrow or on Friday. Maybe this change
> isn't even needed after all.
>

I'm not completely averse to it, but it isn't the best solution to the
use case described.  It seems to me that if you want to hold the line for
that long then the terminating condition you are after is unlikely to be
elapsed time.

If we do go ahead with it, I think you are right, we should switch to long
periods throughout for consistency.  Assuming a switch to ppoll(), the only
wrinkle then being the debounce period which is constrained to 32bit by
the uAPI.  Returning an error if the debounce is greater than 32bit is
probably best, as anyone trying to debounce for periods measured in minutes
or longer is definitely doing something wrong.
So basically your original patch, but with the switch to ppoll().

Cheers,
Kent.

  reply	other threads:[~2024-04-10 10:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-09  9:33 [libgpiod][PATCH 0/2] gpio-tools: allow specifying longer time periods Bartosz Golaszewski
2024-04-09  9:33 ` [libgpiod][PATCH 1/2] build: fix configure error messages on missing functions Bartosz Golaszewski
2024-04-10  7:47   ` Bartosz Golaszewski
2024-04-09  9:33 ` [libgpiod][PATCH 2/2] tools: allow longer time periods Bartosz Golaszewski
2024-04-09 12:55   ` Kent Gibson
2024-04-09 15:59     ` Bartosz Golaszewski
2024-04-09 23:32       ` Kent Gibson
     [not found]     ` <3f31c7bc-de8a-4552-ba48-4432b335f413@igl.se>
2024-04-09 16:05       ` Kent Gibson
2024-04-09 17:24         ` Bartosz Golaszewski
2024-04-09 23:37           ` Kent Gibson
2024-04-10  7:53             ` Bartosz Golaszewski
2024-04-10 10:19               ` Kent Gibson [this message]
2024-04-09 23:52       ` Kent Gibson

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=20240410101938.GA68412@rigel \
    --to=warthog618@gmail.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=gunnar@igl.se \
    --cc=linus.walleij@linaro.org \
    --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 read-only IMAP folder(s) and NNTP newsgroup(s).