Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Nov 2004 23:18:16 -0700 (MST)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        acpi@FreeBSD.org
Subject:   Minor improvement to acpiconf
Message-ID:  <20041115.231816.133541642.imp@bsdimp.com>

next in thread | raw e-mail | index | archive | help
----Next_Part(Mon_Nov_15_23:18:16_2004_769)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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(Mon_Nov_15_23:18:16_2004_769)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="acpiconf.diff"

--- /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);
 }
 

----Next_Part(Mon_Nov_15_23:18:16_2004_769)----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041115.231816.133541642.imp>