Minor improvement to acpiconf
M. Warner Losh
imp at bsdimp.com
Mon Nov 15 22:20:46 PST 2004
acpiconf -i 0 now prints more information about the battery from the bst:
Rate of discharge
Present Capacity
Current Voltage
For example:
Battery 0 information
Design capacity: 48840 mWh
Last full capacity: 47360 mWh
Technology: primary (non-rechargeable)
Design voltage: 11100 mV
Capacity (warn): 0 mWh
Capacity (low): 120 mWh
Low/warn granularity: 0 mWh
Warn/full granularity: 10 mWh
Model number:
Serial number:
Type: LION
OEM info: Sony Corp.
+State: Present
+Rate: 5415 mWh
+Cap: 42730 mWh
+Volt: 12535 mV
Comments?
Warner
-------------- next part --------------
--- /dell/imp/FreeBSD/src/usr.sbin/acpi/acpiconf/acpiconf.c Wed Aug 18 16:14:43 2004
+++ ./acpiconf.c Mon Nov 15 23:12:50 2004
@@ -45,8 +45,8 @@
static int acpifd;
-static int
-acpi_init()
+static void
+acpi_init(void)
{
acpifd = open(ACPIDEV, O_RDWR);
if (acpifd == -1){
@@ -117,6 +117,17 @@
printf("Type:\t\t\t%s\n", battio.bif.type);
printf("OEM info:\t\t%s\n", battio.bif.oeminfo);
+ if (ioctl(acpifd, ACPIIO_CMBAT_GET_BST, &battio) == -1)
+ err(EX_IOERR, "get battery info (%d) failed", num);
+
+ if (battio.bst.state != ACPI_BATT_STAT_NOT_PRESENT) {
+ printf("State:\t\t\tPresent\n");
+ printf("Rate:\t\t\t%d mWh\n", battio.bst.rate);
+ printf("Cap:\t\t\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);
}
More information about the freebsd-acpi
mailing list