fully charged battery is at 118% capacity

Bug #20485 reported by Daniel Robitaille
14
Affects Status Importance Assigned to Milestone
hal (Ubuntu)
Fix Released
Low
Martin Pitt

Bug Description

When running on AC power, the battery applet in gnome-panel thinks the battery
is at a 118% capacity. If I unplug the power cable, then the applet shows the
battery at 100% and falling.

The mismatch in percentage seems to comes from the fact that battery's current
full capacity is below its designed capacity:

$ cat /proc/acpi/battery/BAT0/info
present: yes
design capacity: 4500 mAh
last full capacity: 3800 mAh
battery technology: rechargeable
design voltage: 9600 mV
design capacity warning: 450 mAh
design capacity low: 136 mAh
capacity granularity 1: 45 mAh
capacity granularity 2: 45 mAh
model number: DELL579SN
serial number: 3006
battery type: NiMH
OEM info: Sanyo

When running on AC power:
$ cat /proc/acpi/battery/BAT0/state
present: yes
capacity state: ok
charging state: charged
present rate: 1 mA
remaining capacity: 4500 mAh
present voltage: 10988 mV

When running on Battery power a few seconds later:
$ cat /proc/acpi/battery/BAT0/state
present: yes
capacity state: ok
charging state: discharging
present rate: 1794 mA
remaining capacity: 3800 mAh
present voltage: 11040 mV

Revision history for this message
Matthew Garrett (mjg59) wrote :

That's very odd. Could you possibly attach your DSDT? (/proc/acpi/dsdt)

Revision history for this message
Daniel Robitaille (robitaille) wrote :

Created an attachment (id=3442)
my /proc/acpi/dsdt file

Revision history for this message
Daniel Robitaille (robitaille) wrote :

Yes it is odd, and it is a regression from Hoary installed on the same laptop.

Revision history for this message
Matthew Garrett (mjg59) wrote :

In Hoary, did the battery state change in the same way when fully charged? The
Livecd should be fine for testing this, if you don't still have an install of it.

Revision history for this message
Daniel Robitaille (robitaille) wrote :

In Hoary (I still have it installed in another partition), the gnome panel
applet never displays percentage greater than 100%, either in AC power or on
battery power. But like under Breezy, /proc/acpi/battery/BAT0/state shows a
sudden jump down from 4500mAh to 3800mAh when I unplug the power cable. But in
both states it is never shown as greater than 100% in the applet.

$ cat /proc/acpi/battery/BAT0/info
present: yes
design capacity: 4500 mAh
last full capacity: 3800 mAh
battery technology: rechargeable
design voltage: 9600 mV
design capacity warning: 450 mAh
design capacity low: 136 mAh
capacity granularity 1: 45 mAh
capacity granularity 2: 45 mAh
model number: DELL579SN
serial number: 3006
battery type: NiMH
OEM info: Sanyo

Under AC power:
$ cat /proc/acpi/battery/BAT0/state
present: yes
capacity state: ok
charging state: charged
present rate: 1 mA
remaining capacity: 4500 mAh
present voltage: 10801 mV

Under battery power a few seconds later:
$ cat /proc/acpi/battery/BAT0/state
present: yes
capacity state: ok
charging state: discharging
present rate: 1742 mA
remaining capacity: 3797 mAh
present voltage: 10369 mV

Revision history for this message
Allison Karlitskaya (desrt) wrote :

This is already being tracked upstream at
http://bugzilla.gnome.org/show_bug.cgi?id=315259.

I've written patches for both battstat-applet and HAL. The battstat-applet
patch is meant as a shim and shouldn't be applied if HAL in Breezy is properly
fixed.

I'll attach a copy of the patch that I sent to the hal list for review.

Revision history for this message
Allison Karlitskaya (desrt) wrote :

Created an attachment (id=3559)
hal patch

This test was written this morning and is completely untested (no ACPI laptop
here). It's against HAL CVS but I think Martin has been doing a fairly good
job of keeping the ACPI stuff in sync, so it should apply fairly cleanly to
Breezy. If you guys could test this out and let me know it would be very
appreciated.

Cheers.

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks for the patch! I can't test it either since my laptop is a perfectly
working ( :-) ) iBook with no ACPI whatsoever. However, I ported the patch to
our hal version and prepared an upload. I will actually upload this after the
preview release, then the ACPI-owning folks should give this a thorough test.

Revision history for this message
Martin Pitt (pitti) wrote :

 hal (0.5.3-0ubuntu11) breezy; urgency=low
 .
   * Add debian/patches/signals-hdm.patch:
     - Fix hal-device-manager's signal handling for current dbus.
     - Patch stolen from 0.5.4.
     - Ubuntu #14088
   * debian/control:
     - Move python-launchpad-integration dependency from hal to
       hal-device-manager, where it belongs to.
     - Ubuntu #14860
   * Add debian/patches/acpid-reconnect.patch:
     - Reconnect to acpid if it was restarted.
     - Thanks to Ryan Lortie for this patch.
     - Ubuntu #14852
   * Add debian/patches/acpi-battery-normalization.patch:
     - Ported Ryan Lortie's patch for better calculating battery charge levels.
     - Hopefully fixes Ubuntu #14246.

This version contains the patch. Adam, Daniel (x2), Matthew, can you please test
whether hal now behaves better in terms of battery charge calculation and acpid
restarts?

Revision history for this message
Daniel Robitaille (robitaille) wrote :

While the gnome-panel applet doesn't display anymore a charge of 118% with the
new hal, the status of the battery is still a bit suspect, at least according to
/proc/acpi/battery/BAT0/state

So I went on battery power for a few minutes, enough for the battery applet to
tell me that it was now down to 99%. A look at the state file shows:

daniel@ubuntu:~$ cat /proc/acpi/battery/BAT0/state
present: yes
capacity state: ok
charging state: discharging
present rate: unknown
remaining capacity: 3747 mAh
present voltage: 10033 mV

Now I plug in the AC power, I nearly immediately get:

daniel@ubuntu:~$ cat /proc/acpi/battery/BAT0/state
present: yes
capacity state: ok
charging state: charged
present rate: 1 mA
remaining capacity: 4500 mAh
present voltage: 10479 mV

Let it charge for a few minutes, then unplug it again:
daniel@ubuntu:~$ cat /proc/acpi/battery/BAT0/state
present: yes
capacity state: ok
charging state: charged
present rate: 1602 mA
remaining capacity: 3799 mAh
present voltage: 10486 mV

So while visually the patch makes the applet works a lot better; the state file
of the battery still shows the puzzling fact that it cannot show a battery
charge between 3800 mAh and 4500 mAh. It was the same problem in Hoary. Maybe
I should check from within WinXP in the other partition to see what it displays.
 I have no idea what I actually get with a fully charged battery: its latest
full capacity (3800) or its designed capacity (4500).

Revision history for this message
Allison Karlitskaya (desrt) wrote :

This is a bug in your laptop's ACPI implementation or DSDT tables.
Unfortunately, a lot of laptops have bogus ACPI so the best we can do is work
around it. You could try looking for updated firmware for your laptop or bug
your vendor but short of that things are pretty much going to stay as they are now.

If you're able to find any new bugs in the data as it is displayed with the
battery status applet, your feedback is highly appreciated.

Martin: I'm marking this one FIXED since the new package has hit Breezy. Cheers.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.