-/* $OpenBSD: acpibat.c,v 1.59 2011/10/16 11:59:21 kettenis Exp $ */
+/* $OpenBSD: acpibat.c,v 1.60 2014/05/23 19:17:39 landry Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
*
sensor_attach(&sc->sc_sensdev, &sc->sc_sens[7]);
sc->sc_sens[7].value = sc->sc_bst.bst_voltage * 1000;
+ strlcpy(sc->sc_sens[8].desc, "design capacity",
+ sizeof(sc->sc_sens[8].desc));
+ sc->sc_sens[8].type = type;
+ sensor_attach(&sc->sc_sensdev, &sc->sc_sens[8]);
+ sc->sc_sens[8].value = sc->sc_bif.bif_capacity * 1000;
+
sensordev_install(&sc->sc_sensdev);
}
sc->sc_devnode->name);
if (!sc->sc_bat_present) {
- for (i = 0; i < 8; i++) {
+ for (i = 0; i < 9; i++) {
sc->sc_sens[i].value = 0;
sc->sc_sens[i].status = SENSOR_S_UNSPEC;
sc->sc_sens[i].flags = SENSOR_FINVALID;
sc->sc_sens[7].status = SENSOR_S_UNSPEC;
sc->sc_sens[7].flags = 0;
}
+
+ if (sc->sc_bif.bif_capacity == BIF_UNKNOWN) {
+ sc->sc_sens[8].value = 0;
+ sc->sc_sens[8].status = SENSOR_S_UNKNOWN;
+ sc->sc_sens[8].flags = SENSOR_FUNKNOWN;
+ } else {
+ sc->sc_sens[8].value = sc->sc_bif.bif_capacity * 1000;
+ sc->sc_sens[8].status = SENSOR_S_UNSPEC;
+ sc->sc_sens[8].flags = 0;
+ }
acpi_record_event(sc->sc_acpi, APM_POWER_CHANGE);
}
-/* $OpenBSD: acpidev.h,v 1.33 2012/07/13 10:37:40 pirofti Exp $ */
+/* $OpenBSD: acpidev.h,v 1.34 2014/05/23 19:17:39 landry Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
struct acpibat_bst sc_bst;
volatile int sc_bat_present;
- struct ksensor sc_sens[8];
+ struct ksensor sc_sens[9];
struct ksensordev sc_sensdev;
};