Re: [libgpiod][PATCH 2/2] tools: allow longer time periods

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 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@xxxxxxxxx> 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.




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux