From 95e583726f7fee42316f43501717ba6046f24ce6 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Wed, 24 Nov 2004 15:32:07 +0000 Subject: [PATCH] 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 --- usr.sbin/acpi/acpiconf/acpiconf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/usr.sbin/acpi/acpiconf/acpiconf.c b/usr.sbin/acpi/acpiconf/acpiconf.c index 5ff4cb267a12..53f86046a8b7 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); }