From owner-acpi-jp@jp.freebsd.org  Tue Nov 28 18:31:12 2000
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id SAA05823;
	Tue, 28 Nov 2000 18:31:12 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from kbtfw.kubota.co.jp (firewall-user@kbtfw.kubota.co.jp [133.253.102.202])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id SAA05818
	for <acpi-jp@jp.freebsd.org>; Tue, 28 Nov 2000 18:31:12 +0900 (JST)
	(envelope-from haro@tk.kubota.co.jp)
Received: by kbtfw.kubota.co.jp; id SAA14993; Tue, 28 Nov 2000 18:31:10 +0900 (JST)
Received: from unknown(133.253.122.4) by kbtfw.kubota.co.jp via smap (V4.2)
	id xma014950; Tue, 28 Nov 00 18:30:29 +0900
Received: from jkpc15.tk.kubota.co.jp (IDENT:root@kbtgk.eto.kubota.co.jp [133.253.122.3])
	by kbtmk.eto.kubota.co.jp (8.11.1/8.11.1) with ESMTP id eAS9UTN35767
	for <acpi-jp@jp.freebsd.org>; Tue, 28 Nov 2000 18:30:29 +0900 (JST)
Received: from localhost (localhost.tk.kubota.co.jp [127.0.0.1])
	by jkpc15.tk.kubota.co.jp (8.11.1/3.7W-02/21/99) with ESMTP id eAS9TK519648
	for <acpi-jp@jp.freebsd.org>; Tue, 28 Nov 2000 18:29:20 +0900 (JST)
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 20.7 / Mule 4.0 (HANANOEN)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20001128182920B.haro@tk.kubota.co.jp>
Date: Tue, 28 Nov 2000 18:29:20 +0900
From: Munehiro Matsuda <haro@tk.kubota.co.jp>
X-Dispatcher: imput version 20000228(IM140)
Lines: 48
Reply-To: acpi-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+000315
X-Sequence: acpi-jp 927
Subject: [acpi-jp 927] Re: Some power device driver. 
Errors-To: owner-acpi-jp@jp.freebsd.org
Sender: owner-acpi-jp@jp.freebsd.org
X-Originator: haro@tk.kubota.co.jp

I've found small problem with the way _BIF info is kept in acpi_cmbat.c,
while fiddling with acpibatt program.

Current code assumes that _BIF info does not change while system is up.
But, the lfcap (Last Full Charge Capacity) entry may change with each 
bettery charges done.

I think there are two ways of fixing it, but cannot make up my mind.
Which fix would you prefer?  (BTW, both fix are not tested)

1) Check _BIF info whenever _BST status changes.
  Allways call acpi_cmbat_get_bif() whenever _BST notify event happens:

@@ -208,7 +208,7 @@
 	case ACPI_BATTERY_BST_CHANGE:
 		AcpiOsQueueForExecution(OSD_PRIORITY_LO,
 		    acpi_cmbat_get_bst, context);
-		break;
+		/* Fall through */
 	case ACPI_BATTERY_BIF_CHANGE:
 		AcpiOsQueueForExecution(OSD_PRIORITY_LO,
 		    acpi_cmbat_get_bif, context);

2) Check _BIF info whenever user requests.
  Call acpi_cmbat_get_bif() whenever ACPIIO_CMBAT_GET_BIF ioctl is called
 from user-land:

@@ -298,6 +298,7 @@
 		break;
 
 	case ACPIIO_CMBAT_GET_BIF:
+		acpi_cmbat_get_bif((void *)sc->dev);
 		bifp = (struct acpi_bif *)addr;
 		bifp->unit = sc->bif.unit;
 		bifp->dcap = sc->bif.dcap;

 Thanks in advance,
   Haro
=------------------------------------------------------------------------------
           _ _    Munehiro (haro) Matsuda
 -|- /_\  |_|_|   Business Incubation Dept., Kubota Corp.
 /|\ |_|  |_|_|   1-3 Nihonbashi-Muromachi 3-Chome
                  Chuo-ku Tokyo 103-8310, Japan
                  Tel: +81-3-3245-3318  Fax: +81-3-3245-3315
                  Email: haro@kubota.co.jp



