diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2001-03-22 04:49:15 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2001-03-22 04:49:15 +0000 |
commit | 4c44b1a2977f96249027a32586061c6d1272961a (patch) | |
tree | edf86cdd36a00fe1d1407a2895ad8352ee85c957 /usr.sbin | |
parent | 4da765406150e0d45ae9546fba155b3529e2f9cc (diff) |
Emulate a powerup/powerdown when resuming.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/apmd/apmd.c | 11 |
1 files changed, 9 insertions, 2 deletions
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 |