On Mon, Oct 16, 2017 at 07:51:47PM +0200, Anton Lindqvist wrote:
> On Mon, Oct 16, 2017 at 06:10:02PM +0100, Jason McIntyre wrote:
> > On Mon, Oct 16, 2017 at 06:38:31PM +0200, Anton Lindqvist wrote:
> > > 
> > > Good call. Without knowing too much about the apmd internals, here's a
> > > first stab. As I read the code, the period polling is also used by
> > > auto{suspend,hibernate}. Is this worth mentioning? Since a more frequent
> > > interval will increase the accuracy of the chosen action to perform?
> > > 
> > 
> > hmm. if it does more than what is documented, maybe we could get away
> > with being vaguer, without losing anything important? i'm not sure.
> 
> Input from someone with better knowledge of the implementation would
> help. tedu@ perhaps?
> 

I thought I understood how this works, but sadly I don't and I havn't
had the time to play with it.  The polling however does indeed seem a
bit buggy, see: https://marc.info/?l=openbsd-bugs&m=150784108307789&w=2

I sent a quick patch for this, but now it behaves weird when resuming
instead, as it triggers the check too fast, before the polling has
occured and it still thinks it's on battery, so it suspends twice.

May not be on-topic nor helping, but thought I'd mention it at least.


> > > Index: apmd.8
> > > ===================================================================
> > > RCS file: /cvs/src/usr.sbin/apmd/apmd.8,v
> > > retrieving revision 1.49
> > > diff -u -p -r1.49 apmd.8
> > > --- apmd.8        29 Aug 2017 06:13:20 -0000      1.49
> > > +++ apmd.8        16 Oct 2017 16:29:20 -0000
> > > @@ -57,13 +57,17 @@ When resuming after suspend or standby,
> > >  .Nm
> > >  runs the appropriate configuration program (if one exists).
> > >  .Pp
> > > -When the power status changes
> > > -(battery is connected or disconnected)
> > > +Upon receiving an event from
> > > +.Xr apm 4 ,
> > 
> > have you changed this text because apm can warn about other things than
> > battery connect or just you think it reads better? i ask because what
> > was there was easier to understand.
> 
> Reads better to me, but that's just my opinion and I will revert the
> change.
> 
> > 
> > >  .Nm
> > >  fetches the current status and reports it via
> > >  .Xr syslog 3
> > >  with logging facility
> > >  .Dv LOG_DAEMON .
> > > +In addition,
> > > +.Nm
> > > +periodically polls the power status and reports significant changes to 
> > > the
> > > +battery charge level.
> > >  .Pp
> > >  The options are as follows:
> > >  .Bl -tag -width Ds
> > > @@ -107,14 +111,9 @@ and
> > >  .Nm
> > >  exits without monitoring the APM status.
> > >  .It Fl t Ar seconds
> > > -.Nm
> > > -periodically polls the APM driver for the current power state.
> > > -If the battery charge level changes substantially or the external power
> > > -status changes, the new status is logged.
> > > -The polling rate defaults to
> > > -once per 10 minutes, but may be specified using the
> > > -.Fl t
> > > -command-line flag.
> > > +Set the APM driver poll interval to
> > > +.Ar seconds .
> > > +Defaults to 600 (10 minutes).
> > 
> > yes, now -t is nice and simple. just have to get the top bit right...
> > 
> > >  .It Fl Z Ar percent
> > >  Automatically hibernate the system if no AC is connected and the
> > >  estimated battery life is equal or below
> > > 
> > 
> > jmc
> > 

Reply via email to