From owner-acpi-jp@jp.freebsd.org  Thu Dec  7 20:13:27 2000
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id UAA39063;
	Thu, 7 Dec 2000 20:13:27 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from tasogare.imasy.or.jp (daemon@tasogare.imasy.or.jp [202.227.24.5])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id UAA39052
	for <acpi-jp@jp.freebsd.org>; Thu, 7 Dec 2000 20:13:26 +0900 (JST)
	(envelope-from iwasaki@jp.FreeBSD.org)
Received: from localhost (iwasaki.imasy.or.jp [202.227.24.92])
	by tasogare.imasy.or.jp (8.11.1+3.4W/3.7W-tasogare/smtpfeed 1.07) with ESMTP id eB7BDPk36255
	for <acpi-jp@jp.freebsd.org>; Thu, 7 Dec 2000 20:13:25 +0900 (JST)
	(envelope-from iwasaki@jp.FreeBSD.org)
To: acpi-jp@jp.freebsd.org
In-Reply-To: <20001127163345Y.haro@tk.kubota.co.jp>
References: <200011241628.BAA84647@shidahara1.planet.sci.kobe-u.ac.jp>
	<20001127094651T.haro@tk.kubota.co.jp>
	<20001127163345Y.haro@tk.kubota.co.jp>
X-Mailer: Mew version 1.94.1 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20001207201322Q.iwasaki@jp.FreeBSD.org>
Date: Thu, 07 Dec 2000 20:13:22 +0900
From: Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
X-Dispatcher: imput version 20000228(IM140)
Lines: 76
Reply-To: acpi-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+000315
X-Sequence: acpi-jp 947
Subject: [acpi-jp 947] Re: Some power device driver. 
Errors-To: owner-acpi-jp@jp.freebsd.org
Sender: owner-acpi-jp@jp.freebsd.org
X-Originator: iwasaki@jp.freebsd.org

Hi,

> Here's updated version of IWASAKI-san's "acpibatt" utility.
> 
> Changes to original version are:
>  1) Modified Iwasaki-san's acpibatt.c to have similar output with apm.
>     Added '-v' option to show extra informations.

Remaining battery time seems to be miscalculated?

chandra2# ./acpibatt
ACPI Battey info:
AC Line status: off-line
Remaining battery life: 99%
Remaining battery time: 148 minutes
Number of batteries: 2
Battery 0:
        Battery status: dis-charging
        Remaining battery life: 98%
        Remaining battery time: 67 minutes
        Battery output: 7.68V
Battery 1:
        Battery status: dis-charging
        Remaining battery life: 100%
        Remaining battery time: 81 minutes
        Battery output: 7.68V

These are almost double, compare to what APM BIOS said...

chandra2# apm
APM version: 1.2
APM Managment: Enabled
AC Line status: off-line
Battery status: high
Remaining battery life: 98%
Remaining battery time:  1:13:00
Number of batteries: 2
Battery 0:
        Battery status: high
        Remaining battery life: 98%
        Remaining battery time:  0:36:00
Battery 1:
        Battery status: high
        Remaining battery life: 98%
        Remaining battery time:  0:36:00
Resume timer: disabled
Resume on ring indicator: enabled
APM Capacities:
        global standby state
        global suspend state
        resume timer from suspend

Changing
	bat[i].min = 60 * bat[i].bst.cap / bat[i].bst.rate);
to
	bat[i].min = (60 * bat[i].bst.cap / bat[i].bst.rate) / units;
gives me a correct remaining time.

>  3) Added ioctl API and ACPIIO_ACAD_GET_STATUS ioctl to acpi_acad.c to check
>     AC-line status.

This seems OK, but 0x01 is notified for ACAD when I unplugged.
# It is another Device Check Notification.
I added new case statement in acpi_acad_notify_handler().

>  4) Added creation of /dev/acpi_acad to etc/MAKEDEV

I think this should be /dev/acpi_acad0 if we intend to support DEVFS.
/dev/acpi_acad created by MAKEDEV would be hid by mounting DEVFS, so
better to refer the same device filename as what created by
make_dev().
Or, always assuming there is only one AC Adapter on the machine, and
have hard coded 'acpi_acad' in the device driver too.  This is another
solution, but I prefer the formar.

Thanks
