On 12/01/07, andrew fresh <[EMAIL PROTECTED]> wrote:
I am trying to shut down my laptop using the voltage sensors.
Unfortunatly I can't test this with a generic kernel because all my
sensors on my only -current box come from the ACPI subsystem.

The problem is, the limits don't seems to work:

$ sysctl hw.sensors.acpibat0.volt1
hw.sensors.acpibat0.volt1=7.96 VDC (current voltage), OK
$ tail -3 /etc/sensorsd.conf
hw.sensors.acpibat0.volt1:low=8V:high=9V

sensorsd.conf(5) says the following:

    Sensors that provide status (such as from bio(4), esm(4), or ipmi(4)) do
    not require boundary values specified (that otherwise will be ignored)
    and simply trigger on status transitions.


However, volt0 and volt1 on acpibat never change status from an "OK",
so they will never be triggered in sensorsd, which may or may not be
desirable behaviour.

The following patch will allow you to set high and low values for
volt0 and volt1 on acpibat in sensorsd:

Index: dev/acpi/acpibat.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/acpibat.c,v
retrieving revision 1.37
diff -u -d -p -8 -r1.37 acpibat.c
--- dev/acpi/acpibat.c  2006/12/26 23:58:08     1.37
+++ dev/acpi/acpibat.c  2006/12/31 18:53:01
@@ -128,17 +128,16 @@ acpibat_monitor(struct acpibat_softc *sc
            sizeof(sc->sc_sens[2].desc));
        sc->sc_sens[2].type = type;
        sensor_attach(&sc->sc_sensdev, &sc->sc_sens[2]);
        sc->sc_sens[2].value = sc->sc_bif.bif_low * 1000;

        strlcpy(sc->sc_sens[3].desc, "voltage", sizeof(sc->sc_sens[3].desc));
        sc->sc_sens[3].type = SENSOR_VOLTS_DC;
        sensor_attach(&sc->sc_sensdev, &sc->sc_sens[3]);
-       sc->sc_sens[3].status = SENSOR_S_OK;
        sc->sc_sens[3].value = sc->sc_bif.bif_voltage * 1000;

        strlcpy(sc->sc_sens[4].desc, "battery unknown",
            sizeof(sc->sc_sens[4].desc));
        sc->sc_sens[4].type = SENSOR_INTEGER;
        sensor_attach(&sc->sc_sensdev, &sc->sc_sens[4]);
        sc->sc_sens[4].status = SENSOR_S_UNKNOWN;
        sc->sc_sens[4].value = sc->sc_bst.bst_state;
@@ -153,17 +152,16 @@ acpibat_monitor(struct acpibat_softc *sc
        sc->sc_sens[6].type = type;
        sensor_attach(&sc->sc_sensdev, &sc->sc_sens[6]);
        sc->sc_sens[6].value = sc->sc_bst.bst_capacity * 1000;

        strlcpy(sc->sc_sens[7].desc, "current voltage",
            sizeof(sc->sc_sens[7].desc));
        sc->sc_sens[7].type = SENSOR_VOLTS_DC;
        sensor_attach(&sc->sc_sensdev, &sc->sc_sens[7]);
-       sc->sc_sens[7].status = SENSOR_S_OK;
        sc->sc_sens[7].value = sc->sc_bst.bst_voltage * 1000;

        sensordev_install(&sc->sc_sensdev);
}

void
acpibat_refresh(void *arg)
{

Reply via email to