Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Dec 1998 18:16:58 -0800
From:      Mike Smith <mike@smith.net.au>
To:        mab@alink.net
Cc:        mobile@FreeBSD.ORG
Subject:   Re: APM can suspend right after resume without updating clock 
Message-ID:  <199812180216.SAA00613@dingo.cdrom.com>
In-Reply-To: Your message of "17 Dec 1998 13:28:34 PST." <86empyjw59.fsf@zildjian.hq.alink.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
> when i powered up today, my machine (nec versa lx) suspended
> instantly.  i connected AC power, and powered up again.  dmesg showed
> only this:
> 
> \^G\^G * * * BATTERY IS LOW * * * \^G\^G<5>resumed from suspended mode
> (slept 00:00:41)
> 
> but the first time i powered it up, it had been asleep for over eight
> hours.  unsurprisingly, the clock was off by that amount of time.
> looking at apm.c (2.2.8-STABLE), it's easy to see how this could
> happen: the low power event inevitably suspends the machine right
> away: 
> 
> 		    OPMEV_DEBUGMESSAGE(PMEV_BATTERYLOW);
> 			apm_battery_low();
> 			apm_suspend();
> 			break;
> 
> my guess is that for some reason, the APM code got hold of the low
> battery event before the resume event.  unfortunately, i don't know
> how best to fix this.  is it easy to schedule the suspend a little bit 
> into the future, to catch other events? 

Not really easily, no.  I'm not sure that it'd actually be terribly 
useful to do that either, apart from the improved sleep time message.  

> would it be easy to update
> the clock before suspending?

Ah, I think I see what you mean; the loss of the resume message means 
that the clock hasn't been updated.  Probably a better approach would 
simply be to reload the system clock from the RTC.

>  could suspending on low battery be left
> up to user code?

What benefits would that bring?  The events still need to be fetched in 
the kernel, and most event handling is pretty trivial...

-- 
\\  Sometimes you're ahead,       \\  Mike Smith
\\  sometimes you're behind.      \\  mike@smith.net.au
\\  The race is long, and in the  \\  msmith@freebsd.org
\\  end it's only with yourself.  \\  msmith@cdrom.com



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-mobile" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812180216.SAA00613>