be more picky about running /etc/apm/{battery,line} in response
to APM_POWER_CHANGE event. some BIOS post this event periodically while the battery is charging/discharging (no change in a/c state). on these systems this prevents /etc/apm/{battery,line} from being run multiple times.
This commit is contained in:
parent
37247109d1
commit
739ac42b5e
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: apmd.c,v 1.16 2001/01/11 01:35:53 lukem Exp $ */
|
||||
/* $NetBSD: apmd.c,v 1.17 2001/01/25 00:48:59 chuck Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -314,6 +314,7 @@ main(int argc, char *argv[])
|
|||
fd_set selcopy;
|
||||
struct apm_event_info apmevent;
|
||||
int suspends, standbys, resumes;
|
||||
int ac_is_off;
|
||||
int noacsleep = 0;
|
||||
int lowbattsleep = 0;
|
||||
mode_t mode = 0660;
|
||||
|
@ -414,6 +415,7 @@ main(int argc, char *argv[])
|
|||
struct apm_power_info pinfo;
|
||||
power_status(ctl_fd, 1, &pinfo);
|
||||
do_ac_state(pinfo.ac_state);
|
||||
ac_is_off = (pinfo.ac_state == APM_AC_OFF);
|
||||
}
|
||||
|
||||
(void) signal(SIGTERM, sigexit);
|
||||
|
@ -484,7 +486,11 @@ main(int argc, char *argv[])
|
|||
{
|
||||
struct apm_power_info pinfo;
|
||||
power_status(ctl_fd, 0, &pinfo);
|
||||
do_ac_state(pinfo.ac_state);
|
||||
/* power status can change without ac status changing */
|
||||
if (ac_is_off != (pinfo.ac_state == APM_AC_OFF)) {
|
||||
do_ac_state(pinfo.ac_state);
|
||||
ac_is_off = (pinfo.ac_state == APM_AC_OFF);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue