From 4c44b1a2977f96249027a32586061c6d1272961a Mon Sep 17 00:00:00 2001 From: "Angelos D. Keromytis" Date: Thu, 22 Mar 2001 04:49:15 +0000 Subject: Emulate a powerup/powerdown when resuming. --- usr.sbin/apmd/apmd.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/apmd/apmd.c b/usr.sbin/apmd/apmd.c index c4f467ce26e..ebff27fea58 100644 --- a/usr.sbin/apmd/apmd.c +++ b/usr.sbin/apmd/apmd.c @@ -418,7 +418,11 @@ main(int argc, char *argv[]) if (ready == 0) { /* wakeup for timeout: take status */ - power_status(ctl_fd, 0, 0); + powerbak = power_status(ctl_fd, 0, 0); + if (powerstatus != powerbak) { + powerstatus = powerbak; + powerchange = 1; + } } if (FD_ISSET(ctl_fd, selfdsp)) { suspends = standbys = resumes = 0; @@ -444,6 +448,8 @@ main(int argc, char *argv[]) case APM_NORMAL_RESUME: case APM_CRIT_RESUME: case APM_SYS_STANDBY_RESUME: + powerstatus = power_status(ctl_fd, 0, 0); + powerchange = 1; resumes++; break; case APM_POWER_CHANGE: @@ -467,7 +473,8 @@ main(int argc, char *argv[]) } else if (resumes) { resume(ctl_fd); syslog(LOG_NOTICE, "system resumed from APM sleep"); - } else if (powerchange) { + } + if (powerchange) { if (powerstatus) powerup(ctl_fd); else -- cgit v1.2.3