Subject: Re: Bogus ACPI battery information in recent current
To: Sverre Froyen <sverre@viewmark.com>
From: Steven M. Bellovin <smb@cs.columbia.edu>
List: current-users
Date: 12/13/2007 22:18:21
On Thu, 13 Dec 2007 14:27:50 -0700
Sverre Froyen <sverre@viewmark.com> wrote:

> Hi,
> 
> With the latest current, I'm seeing bogus values for the battery
> information. An example (4.99.42 from this morning):
> 
> # envstat
> [acpiacad0]
>   connected:         ON
> [acpibat0]
>          present:         ON
>       design cap:    164.010 Wh
>    last full cap:    492.800 Wh
>       technology:          1
>   design voltage:     10.772 V
>         warn cap:     24.640 Wh ( 5.00%)
>          low cap:      0.200 Wh ( 0.04%)
>          voltage:     12.417 V
>      charge rate:        N/A
>   discharge rate:        N/A
>           charge:     44.690 Wh ( 9.07%)
>         charging:        OFF
>     charge state:     NORMAL
> [acpitz0]
>      temperature:     52.000 degC
> [aps0]
>           aps0 X_ACCEL:        476
>           aps0 Y_ACCEL:        514
>             aps0 X_VAR:        476
>             aps0 Y_VAR:        514
>            aps0 TEMP_1:     44.000 degC
>            aps0 TEMP_2:     44.000 degC
>   aps0 Keyboard Active:         ON
>      aps0 Mouse Active:        OFF
>          aps0 Lid Open:         ON
> 
> Notice the "last full cap" and the "design cap" values.  There is
> also a very noticable delay before the output appears.  With my
> latest good kernel (4.99.40 from 6 Dec),  I get
> 
I wonder if this is related to my "sudden shutdown" issue.  (I alluded
to it on tech-userlevel in a different thread.)  Here's some
curious output, using a kernel from this afternoon's source:

b129$ grep powerd /var/log/messages
Dec 13 17:03:41 berkshire root: /etc/powerd/scripts/acadapter: Full performance mode
Dec 13 17:04:25 berkshire root: /etc/powerd/scripts/sensor_battery: (charge state) state changed to CRITICAL [acpibat0]
Dec 13 17:05:03 berkshire root: /etc/powerd/scripts/sensor_battery: (charge state) capacity reached normal state [acpibat0]
Dec 13 17:06:05 berkshire root: /etc/powerd/scripts/sensor_battery: (charge state) state changed to CRITICAL [acpibat0]
Dec 13 17:07:02 berkshire root: /etc/powerd/scripts/sensor_battery: (charge state) capacity reached normal state [acpibat0]
Dec 13 17:08:04 berkshire root: /etc/powerd/scripts/sensor_battery: (charge state) state changed to CRITICAL [acpibat0]
Dec 13 17:08:36 berkshire root: /etc/powerd/scripts/sensor_battery: (charge state) capacity reached normal state [acpibat0]
b130$ date -r `cat /kern/boottime`
Thu Dec 13 17:03:05 EST 2007

The charge level has been over 40% the entire time since this reboot.  I
have no idea why it shows several transitions.  If the AC adapter status
is somehow subject to similar glitches, it would explain why the machine
frequently powers down when going multiuser.  (Aside: I changed the
'shutdown now' in /etc/powerd/scripts/sensor_battery to 'shutdown +5',
to give me a chance to do something sane when the kernel gets it wrong.)

		--Steve Bellovin, http://www.cs.columbia.edu/~smb