On Sat, Jul 28, 2018 at 08:30:36PM +0200, Oliver Jan Krylow wrote: > Hello List! > > I have apmd configured with flags "-A -Z10 -t60" on a Thinkpad x230. > > When the machine hits <10% battery it hibernates (as it should). > I then attach the AC and boot up again. > The bsd.booted kernel boots up, but once the OS is up a moment, it reboots. > This happens 2-3 times. > Sometimes the hibernate state is lost, sometimes not. > > What I think happens is, that after boot the battery is still under 10%, so > apmd hibernates until battery is >10%. > > Is apmd not supposed to ignore '-Z' when AC is connected? > > I tried working around the problem with a custom /etc/apm/hibernate script, > but I failed to understand how it is supposed to be used. The documentation > is > not clear on that. > > For example, how do I hibernate in the script when 'apm -Z' and 'ZZZ' call > the script (I assume). > > Is this a bug? > > OpenBSD 6.3-current snapshot from 27.07.2018. > > --- > O. J. Krylow >
Probably an oversight. You could probably make a fairly simple diff to do what you wanted though. Looks like apmd.c:147 has code to extract out the ac state. You could duplicate that below, in the for (;;) loop body in main - get ac state before determining if 'autoaction' should actually call something. -ml

