Update to match current kernel code.
This commit is contained in:
parent
5b53183e98
commit
6263ca5fa3
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: envstat.c,v 1.45 2007/09/02 21:25:25 xtraeme Exp $ */
|
||||
/* $NetBSD: envstat.c,v 1.46 2007/09/04 16:54:37 xtraeme Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -88,7 +88,7 @@ struct envsys_sensor {
|
|||
char desc[ENVSYS_DESCLEN];
|
||||
char type[ENVSYS_DESCLEN];
|
||||
char drvstate[ENVSYS_DESCLEN];
|
||||
char genstr[ENVSYS_DESCLEN];
|
||||
char battstate[ENVSYS_DESCLEN];
|
||||
};
|
||||
|
||||
static int interval, flags, width;
|
||||
|
@ -668,12 +668,12 @@ find_sensors(prop_array_t array)
|
|||
prop_string_cstring_nocopy(obj1),
|
||||
sizeof(gesen[gnelems].drvstate));
|
||||
|
||||
/* get current generic state string */
|
||||
obj1 = prop_dictionary_get(obj, "generic-state-string");
|
||||
/* get current battery state string */
|
||||
obj1 = prop_dictionary_get(obj, "battery-state");
|
||||
if (obj1 != NULL)
|
||||
(void)strlcpy(gesen[gnelems].genstr,
|
||||
(void)strlcpy(gesen[gnelems].battstate,
|
||||
prop_string_cstring_nocopy(obj1),
|
||||
sizeof(gesen[gnelems].genstr));
|
||||
sizeof(gesen[gnelems].battstate));
|
||||
|
||||
/* get current value */
|
||||
obj1 = prop_dictionary_get(obj, "cur-value");
|
||||
|
@ -842,11 +842,7 @@ print_sensors(struct envsys_sensor *es, size_t nelems)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (strcmp(es[i].type, "Generic string") == 0) {
|
||||
|
||||
(void)printf(": %10s", es[i].genstr);
|
||||
|
||||
} else if (strcmp(es[i].type, "Indicator") == 0) {
|
||||
if (strcmp(es[i].type, "Indicator") == 0) {
|
||||
|
||||
(void)printf(": %10s", es[i].cur_value ? "ON" : "OFF");
|
||||
|
||||
|
@ -903,11 +899,16 @@ do { \
|
|||
|
||||
(void)printf(": %10d", es[i].cur_value);
|
||||
|
||||
/* drives */
|
||||
/* drives */
|
||||
} else if (strcmp(es[i].type, "Drive") == 0) {
|
||||
|
||||
(void)printf(": %10s", es[i].drvstate);
|
||||
|
||||
/* Battery state */
|
||||
} else if (strcmp(es[i].type, "Battery state") == 0) {
|
||||
|
||||
(void)printf(": %10s", es[i].battstate);
|
||||
|
||||
/* everything else */
|
||||
} else {
|
||||
const char *type;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: powerd.8,v 1.13 2007/07/16 17:49:56 xtraeme Exp $
|
||||
.\" $NetBSD: powerd.8,v 1.14 2007/09/04 16:54:37 xtraeme Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2003 Wasabi Systems, Inc.
|
||||
.\" All rights reserved.
|
||||
|
@ -33,7 +33,7 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd July 16, 2007
|
||||
.Dd September 4, 2007
|
||||
.Dt POWERD 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -129,18 +129,20 @@ when a power button is pressed by the operator:
|
|||
.Ed
|
||||
.Ss ENVSYS SCRIPTS
|
||||
.Xr envsys 4
|
||||
scripts are called when a critical condition was triggered in
|
||||
a sensor.
|
||||
scripts are called when a condition was triggered in a sensor.
|
||||
These scripts are called with three arguments: the
|
||||
device associated, the event type, and sensor's name.
|
||||
The
|
||||
.Sy sensor_drive
|
||||
sensor uses a fourth argument: state description.
|
||||
and the
|
||||
.Sy sensor_battery
|
||||
scripts uses a fourth argument: state description.
|
||||
.Pp
|
||||
The following envsys script names are defined:
|
||||
.Bl -tag -width "sensor_temperature"
|
||||
.It sensor_battery
|
||||
This script is called when an event occurs on a battery sensor (Wh/Ah).
|
||||
This script is called when an event occurs on a battery sensor
|
||||
(Wh/Ah/Battery state).
|
||||
.It sensor_drive
|
||||
This script is called when an event occurs on a drive sensor.
|
||||
.It sensor_fan
|
||||
|
@ -179,16 +181,16 @@ A warning under condition was triggered.
|
|||
A warning over condition was triggered.
|
||||
.El
|
||||
.Pp
|
||||
The following events are defined for battery sensors:
|
||||
The following event is defined only for battery sensors:
|
||||
.Bl -tag -width "sensor_temperature"
|
||||
.It user-capacity
|
||||
A capacity limit set by the user was triggered.
|
||||
Capacity dropped below the limit set by the user.
|
||||
.El
|
||||
.Pp
|
||||
The following events are defined for drive sensors:
|
||||
The following events are defined for drive and battery sensors:
|
||||
.Bl -tag -width "sensor_temperature"
|
||||
.It state-changed
|
||||
The state on the sensor changed and it's not in a valid state.
|
||||
The state on the sensor has been changed and it's not in normal state.
|
||||
.El
|
||||
.Pp
|
||||
The following is an example of how a temperature sensor script might be
|
||||
|
@ -203,7 +205,6 @@ invoked when a critical over condition is triggered:
|
|||
.Xr acpilid 4 ,
|
||||
.Xr envsys 4 ,
|
||||
.Xr i386/apm 4
|
||||
.\" .Xr sysmon 4
|
||||
.Sh HISTORY
|
||||
.Nm
|
||||
first appeared in
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: powerd.c,v 1.8 2007/07/01 07:39:47 xtraeme Exp $ */
|
||||
/* $NetBSD: powerd.c,v 1.9 2007/09/04 16:54:37 xtraeme Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Wasabi Systems, Inc.
|
||||
|
@ -318,7 +318,7 @@ dispatch_power_event_state_change(int fd, power_event_t *pev)
|
|||
obj = prop_dictionary_get(dict, "sensor-name");
|
||||
argv[3] = prop_string_cstring_nocopy(obj);
|
||||
|
||||
obj = prop_dictionary_get(dict, "drive-state-desc");
|
||||
obj = prop_dictionary_get(dict, "state-description");
|
||||
argv[4] = prop_string_cstring_nocopy(obj);
|
||||
|
||||
argv[5] = NULL;
|
||||
|
|
Loading…
Reference in New Issue