Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi display the V, W, and Wh rather than mV, mW, an...
details: https://anonhg.NetBSD.org/src/rev/c4e6dbcc9e90
branches: trunk
changeset: 534760:c4e6dbcc9e90
user: explorer <explorer%NetBSD.org@localhost>
date: Fri Aug 02 16:51:48 2002 +0000
description:
display the V, W, and Wh rather than mV, mW, and mWh
diffstat:
sys/dev/acpi/acpi_bat.c | 41 ++++++++++++++++++++---------------------
1 files changed, 20 insertions(+), 21 deletions(-)
diffs (76 lines):
diff -r cae366c9eab9 -r c4e6dbcc9e90 sys/dev/acpi/acpi_bat.c
--- a/sys/dev/acpi/acpi_bat.c Fri Aug 02 15:05:57 2002 +0000
+++ b/sys/dev/acpi/acpi_bat.c Fri Aug 02 16:51:48 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_bat.c,v 1.1 2002/03/24 03:46:10 sommerfeld Exp $ */
+/* $NetBSD: acpi_bat.c,v 1.2 2002/08/02 16:51:48 explorer Exp $ */
/*
* Copyright 2001 Bill Sommerfeld.
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.1 2002/03/24 03:46:10 sommerfeld Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.2 2002/08/02 16:51:48 explorer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -78,8 +78,9 @@
#define ABAT_F_VERBOSE 0x01 /* verbose events */
#define ABAT_F_PWRUNIT_MA 0x02 /* mA instead of mW */
-#define ACM_RATEUNIT(sc) (((sc)->sc_flags & ABAT_F_PWRUNIT_MA)?"mA":"mW")
-#define ACM_CAPUNIT(sc) (((sc)->sc_flags & ABAT_F_PWRUNIT_MA)?"mAh":"mWh")
+#define ACM_RATEUNIT(sc) (((sc)->sc_flags & ABAT_F_PWRUNIT_MA)?"A":"W")
+#define ACM_CAPUNIT(sc) (((sc)->sc_flags & ABAT_F_PWRUNIT_MA)?"Ah":"Wh")
+#define ACM_SCALE(x) ((x) / 1000), ((x) % 1000)
int acpibat_match(struct device *, struct cfdata *, void *);
void acpibat_attach(struct device *, struct device *, void *);
@@ -214,12 +215,12 @@
p2[12].String.Pointer, p2[11].String.Pointer,
p2[9].String.Pointer, p2[10].String.Pointer);
- printf("%s: Design %d%s, Predicted %d%s Warn %d%s Low %d%s\n",
- sc->sc_dev.dv_xname,
- sc->sc_design_capacity, ACM_CAPUNIT(sc),
- sc->sc_pred_capacity, ACM_CAPUNIT(sc),
- sc->sc_warn_capacity, ACM_CAPUNIT(sc),
- sc->sc_low_capacity, ACM_CAPUNIT(sc));
+ printf("%s: Design %d.%03d%s, Predicted %d.%03d%s Warn %d.%03d%s Low %d.%03d%s\n",
+ sc->sc_dev.dv_xname,
+ ACM_SCALE(sc->sc_design_capacity), ACM_CAPUNIT(sc),
+ ACM_SCALE(sc->sc_pred_capacity), ACM_CAPUNIT(sc),
+ ACM_SCALE(sc->sc_warn_capacity), ACM_CAPUNIT(sc),
+ ACM_SCALE(sc->sc_low_capacity), ACM_CAPUNIT(sc));
out:
AcpiOsFree(buf.Pointer);
}
@@ -258,17 +259,15 @@
sc->sc_mv = p2[3].Integer.Value;
if (sc->sc_flags & ABAT_F_VERBOSE) {
- printf("%s: %s%s: %dmV cap %d%s (%d%%) rate %d%s\n",
- sc->sc_dev.dv_xname,
- (sc->sc_status&4) ? "CRITICAL ":"",
- (sc->sc_status&1) ? "discharging" : (
- (sc->sc_status & 2) ? "charging" : "idle"),
- sc->sc_mv,
- sc->sc_capacity,
- ACM_CAPUNIT(sc),
- (sc->sc_capacity * 100) / sc->sc_design_capacity,
- sc->sc_rate,
- ACM_RATEUNIT(sc));
+ printf("%s: %s%s: %d.%03dV cap %d.%03d%s (%d%%) rate %d.%03d%s\n",
+ sc->sc_dev.dv_xname,
+ (sc->sc_status&4) ? "CRITICAL ":"",
+ (sc->sc_status&1) ? "discharging" : (
+ (sc->sc_status & 2) ? "charging" : "idle"),
+ ACM_SCALE(sc->sc_mv),
+ ACM_SCALE(sc->sc_capacity), ACM_CAPUNIT(sc),
+ (sc->sc_capacity * 100) / sc->sc_design_capacity,
+ ACM_SCALE(sc->sc_rate), ACM_RATEUNIT(sc));
}
out:
AcpiOsFree(buf.Pointer);
Home |
Main Index |
Thread Index |
Old Index