summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2004-11-24 15:32:07 +0000
committerimp <imp@FreeBSD.org>2004-11-24 15:32:07 +0000
commitd211cd088bdc99d0652ca133a3d982b42a66b037 (patch)
tree9f67cd2b42b3608120b07d24e5863ad9db0b7273 /usr.sbin
parent2a3801783ba516b77812f084b8ff0cf644ecb9aa (diff)
downloadFreeBSD-src-d211cd088bdc99d0652ca133a3d982b42a66b037.zip
FreeBSD-src-d211cd088bdc99d0652ca133a3d982b42a66b037.tar.gz
phk jumped the gun and posted what looks like a preliminary version of
my patches for this information. Commit my more complete version. This version isn't complete yet, since some details aren't handled right just yet. Poaching by: phk
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/acpi/acpiconf/acpiconf.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/acpi/acpiconf/acpiconf.c b/usr.sbin/acpi/acpiconf/acpiconf.c
index 5ff4cb2..53f8604 100644
--- a/usr.sbin/acpi/acpiconf/acpiconf.c
+++ b/usr.sbin/acpi/acpiconf/acpiconf.c
@@ -118,11 +118,15 @@ acpi_battinfo(int num)
battio.unit = num;
if (ioctl(acpifd, ACPIIO_CMBAT_GET_BST, &battio) == -1)
err(EX_IOERR, "get battery info (%d) failed", num);
- printf("State:\t\t\t%d\n", battio.bst.state);
- printf("Present rate:\t\t%d\n", battio.bst.rate);
- printf("Remaining capacity:\t%d mWh\n", battio.bst.cap);
- printf("Volt:\t\t\t%.3f V\n", battio.bst.volt * .001);
+ if (battio.bst.state != ACPI_BATT_STAT_NOT_PRESENT) {
+ printf("State:\t\t\tPresent\n");
+ printf("Present Rate:\t\t%d mWh\n", battio.bst.rate);
+ printf("Remaining Capacity:\t%d mWh\n", battio.bst.cap);
+ printf("Volt:\t\t\t%d mV\n", battio.bst.volt);
+ } else {
+ printf("State:\t\t\tNot Present\n");
+ }
return (0);
}
OpenPOWER on IntegriCloud