From owner-freebsd-acpi@FreeBSD.ORG Tue Nov 16 06:20:46 2004 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CC60F16A4CE for ; Tue, 16 Nov 2004 06:20:46 +0000 (GMT) Received: from harmony.village.org (rover.village.org [168.103.84.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5B0D043D48 for ; Tue, 16 Nov 2004 06:20:46 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (harmony.village.org [10.0.0.6]) by harmony.village.org (8.13.1/8.13.1) with ESMTP id iAG6Humu029165 for ; Mon, 15 Nov 2004 23:17:57 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Mon, 15 Nov 2004 23:18:16 -0700 (MST) Message-Id: <20041115.231816.133541642.imp@bsdimp.com> To: acpi@FreeBSD.org From: "M. Warner Losh" X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Mon_Nov_15_23:18:16_2004_769)--" Content-Transfer-Encoding: 7bit Subject: Minor improvement to acpiconf X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Nov 2004 06:20:46 -0000 ----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)----