After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 486953 - gnome-power-manager shows 2 batteries instead of 1
gnome-power-manager shows 2 batteries instead of 1
Status: RESOLVED NOTGNOME
Product: gnome-power-manager
Classification: Deprecated
Component: applets
2.20.x
Other All
: Normal minor
: ---
Assigned To: GNOME Power Manager Maintainer(s)
GNOME Power Manager Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2007-10-15 21:08 UTC by Roel Huybrechts
Modified: 2008-04-13 18:42 UTC
See Also:
GNOME target: ---
GNOME version: 2.19/2.20


Attachments
gnome-power-bugreport.sh output (3.46 KB, text/x-log)
2008-02-08 09:41 UTC, Roel Huybrechts
Details
gnome-power-bugreport.sh output for Lenovo Thinkpad T61 (3.84 KB, text/plain)
2008-02-08 09:46 UTC, Jerone Young
Details
gnome-power-bugreport.sh output for Lenovo Thinkpad T61 (3.84 KB, text/plain)
2008-02-08 09:50 UTC, Jerone Young
Details
HAL output for Lenovo Thinkpad T61 (131.22 KB, text/plain)
2008-02-08 09:54 UTC, Jerone Young
Details
lshal output (123.24 KB, text/plain)
2008-04-07 07:44 UTC, Christoph Kindl
Details
g-pm bugreport output (3.65 KB, text/plain)
2008-04-07 07:45 UTC, Christoph Kindl
Details

Description Roel Huybrechts 2007-10-15 21:08:19 UTC
Please describe the problem:
This problem occurs on Ubuntu Gutsy Beta (GPM 2.20.0-ubuntu6), not on Feisty (GPM 2.18.2-ubuntu3); on my laptop which is an Acer Aspire 1692 with (1 !) Sanyo ZL01 battery.

Gnome-power-manager shows me two batteries while I only have one in my laptop. The first one is my actual battery and is recognized perfectly -- showing charging, discharging, capacity etc. The second one is shown as 0% loaded all the time and by clicking on it, it says "Status: missing".

/proc/acpi/battery also shows two batteries: BAT1 and BAT2 (On Gutsy that is, I'll add the state of /proc/acpi/battery on Feisty in a comment)

BAT1/info:
present: yes
design capacity: 4400 mAh
last full capacity: 2665 mAh
battery technology: rechargeable
design voltage: 14800 mV
design capacity warning: 300 mAh
design capacity low: 132 mAh
capacity granularity 1: 32 mAh
capacity granularity 2: 32 mAh
model number: ZL01
serial number: 60219
battery type: LION
OEM info: SANYO

BAT2/info:
present: no

**
On Feisty /proc/acpi/battery shows the same BAT1 and BAT2 with the same info files as on Gutsy, thus this might not be related to the problem.

Steps to reproduce:
1. Click the GPM notification icon

Actual results:
Two batteries are shown (the actual battery being the first + another one 0% charged and status: missing)

Expected results:
Only one battery shown.

Does this happen every time?
Yes

Other information:
This bug was originally reported at the Ubuntu bug tracker: https://bugs.launchpad.net/ubuntu/+source/gnome-power-manager/+bug/146803
Comment 1 Richard Hughes 2007-10-23 17:06:59 UTC
Either the kernel or the hardware is lying to us, I'm guessing it's the hardware. Do you have a second battery bay (removable cdrom etc) anywhere on the unit? Or a docking unit?
Comment 2 Roel Huybrechts 2007-10-23 17:17:09 UTC
There is only 1 battery bay, though the battery itself is (off course) removable. Cd-rom is not removable and I'm not using a docking unit.
Comment 3 Jerone Young 2008-02-08 06:55:47 UTC
I can confirm this also (as I am looking into this problem). My Thinkpad T61 has 1 battery and works it shows only 1 in older version of gnome-power-manager. But since I went to Ubuntu Hardy .. it now show 2 and this is not correct at all.
Comment 4 Jerone Young 2008-02-08 08:12:46 UTC
hal-device is only reporting 1 battery. So something in the code is very very wrong but looking at the 2 batteries it is reading from 

I see the problem now
Battery1 is reading /proc/acpi/battery/BAT0/state

Battery2 is reading /proc/acpi/battery/BAT0/info

But there is ONLY 1 real Battery. It appears somebody just put some dumb code into gnome-power-manager.
Comment 5 Richard Hughes 2008-02-08 08:37:26 UTC
>It appears somebody just put some dumb code into gnome-power-manager

Jerone, thanks for the insult. Please can you attach the output of gnome-power-bugreport.sh to this bug and then we can see where the problem actually is.

>I see the problem now
>Battery1 is reading /proc/acpi/battery/BAT0/state
>Battery2 is reading /proc/acpi/battery/BAT0/info

I can assure you this isn't the case, as gnome-power-manager does not read these files, it gets the information from an abstract battery device from HAL. Seeing as I also wrote the code in HAL to read the battery device, I can also assure you that we only specify one battery for a single ACPI device as state and info have different information. It's likely you have two battery frameworks compiled into your kernel, but without the bugreport data I can't tell.

Thanks,

Richard.
Comment 6 Jerone Young 2008-02-08 09:28:00 UTC
Hehe :-) .. Didn't mean to be insulting .. but there really is only 1 battery. Previous versions of Gnome-power-manager (2.20.0) do not do this on the exact same laptop (Lenove Thinkpad T61). In ACPI there is only 1 Battery BAT@0. HAL even only shows 1 battery. I'm not sure what you mean by two battery frameworks? I though ACPI was the only battery framework. What other frame work could you be talking about? 

But the output that I see for each battery exactly matches what is in the "state" & "info" file in ACPI. The one it should not be showing is the "state". 

There is some info in this bugzilla here:
https://bugs.launchpad.net/ubuntu/+source/gnome-power-manager/+bug/146803

The reason people are seeing this now is many are starting to play with Ubuntu Hardy builds and that is using 2.21.1 of Gnome-power-manager. There are more then this bugzilla

I'll bring more data tomorrow.
Comment 7 Roel Huybrechts 2008-02-08 09:41:07 UTC
Created attachment 104693 [details]
gnome-power-bugreport.sh output
Comment 8 Jerone Young 2008-02-08 09:44:17 UTC
Actually I take that back, the outputs are not exactly the same as the ACPI files. But the two batteries it shows (even though there really is only 1) do report diffrent things and also throw off the overall amount of the battery has.


Here is the exact out put from Gnome-power-manager taken from my Lenovo Thinkpad T61 with 1 battery. Mine up this is running on battery right now and not plugged in the wall.

Reported Battery 1:
        Product: Battery Bay
        Status: Discharging
        Percentage charge: 56%
        Vendor: SANYO
        Technology: Lithium ion
        Serial 36030
        Model: 42T5229
        Charge time: 2 hours 5 minutes
        Discharge time: 2 hours 4 minutes
        Capacity: 100% (Excellent)
        Current charge: 37.4 Wh
        Last full charge: 65.8 Wh
        Design charge: 65.5wh
        Charge rate: 18.0W

Reported Battery 2:
        Product: 42T5229
        Status: Charged
        Percent charge: 64%
        Vendor: SANYO
        Technoloy: Lithium ion
        Current charge: 42.2 Wh
        Last full charge: 65.8 Wh


This is the same 1 battery but notice the Percent charge has diffrent values. This throws the overall stats off. I'll say again, with Gnome-power-manager 2.20.0 and that is with 2.6.22 kernel. 

I will attach hal-device data as well as ACPI output.
Comment 9 Jerone Young 2008-02-08 09:46:43 UTC
Created attachment 104694 [details]
gnome-power-bugreport.sh output for Lenovo Thinkpad T61
Comment 10 Jerone Young 2008-02-08 09:50:20 UTC
Created attachment 104695 [details]
gnome-power-bugreport.sh output for Lenovo Thinkpad T61
Comment 11 Jerone Young 2008-02-08 09:54:50 UTC
Created attachment 104696 [details]
HAL output for Lenovo Thinkpad T61
Comment 12 Jerone Young 2008-02-08 09:59:23 UTC
Other things to notice from the output is that it shows that one is charging  and has a big % charge diffrence.. while the other one isn't. Something really funky is going on. My laptop is running off of battery.  So I have no idea where this second reported battery data is coming from.

So the 1st Reported Battery is my battery. But this second one I have no clue what's up with it. has properties of my battery but showing values that make little since.
Comment 13 Richard Hughes 2008-02-08 16:09:20 UTC
Your kernel is probably being built with CONFIG_ACPI_BATTERY and CONFIG_POWER_SUPPLY defined. Either use the old or the new interface, but not both.
Comment 14 Jerone Young 2008-02-08 23:58:35 UTC
The solution to this problem is to get the latest version of HAL (still in git). I compiled HAL from git and now it shows one battery as it should.

The git repository can be found here:

http://gitweb.freedesktop.org/?p=hal.git;a=summary

Hopefully they will mark a new release in time for Hardy... so ubuntu can pull it in.

Comment 15 Khashayar Naderehvandi 2008-02-09 15:37:05 UTC
(In reply to comment #14)
> The solution to this problem is to get the latest version of HAL (still in
> git). I compiled HAL from git and now it shows one battery as it should.
> 
> The git repository can be found here:
> 
> http://gitweb.freedesktop.org/?p=hal.git;a=summary
> 
> Hopefully they will mark a new release in time for Hardy... so ubuntu can pull
> it in.
> 

Do you by any chance know which commits are responsible for fixing it?
Otherwise, perhaps Richard would give a pointer?

I have only found this http://gitweb.freedesktop.org/?p=hal.git;a=commit;h=f018f6480384e2607aa3cac6aad5f114b832ebc0, but that doesn't seem to be all there is to it.
Comment 16 Craig Huffstetler 2008-02-14 05:33:02 UTC
This also in Ubuntu Hardy Haron for me (not in Gutsy, however). When I installed Debian Lenny on the same laptop a few days after Hardy Haron it was fine (I had to get out of that mess!) (...of course Debian's gnome-power-manager was a slightly earlier version which most likely did not contain this bug as of yet).

Version *.19.0

I am not quite sure what the *-ubuntu6 means. Anyways, just offering my input and experience/confirmation of this bug.

It is in Launchpad.net (Ubuntu's tracking system) and I believe they have it pegged on HAL.

For the record it seems everyone who experiences this is on IBM made laptops -- I am on a Lenovo Z60M myself. Has this been true thus far? Just something I picked up through the various threads.

Sincerely,

Craig Huffstetler
Comment 17 Craig Huffstetler 2008-02-14 05:38:12 UTC
Fixed upstream according to Launchpad:

https://bugs.launchpad.net/ubuntu/+source/hal/+bug/177570
---> https://bugs.freedesktop.org/show_bug.cgi?id=13669

Craig Huffstetler / xq
Comment 18 Christoph Kindl 2008-04-07 07:43:37 UTC
Hi,

have got the same problem, but gnome-power-manager shows 3 different batteries:

(AC is plugged in)
:1::
Product: Battery Bay
Status: Charged
Charge Status: 100%
Manufacturer: SANYO
Technique: Li-Ion

:2::
Status: not available
Charge Status: 0%

:3::
Product: Li-ion
Status: Discharging (AC is plugged in - WRONG!)
Manufacturer: SANYO
Technique: Li-Ion

Furthermore gnome-power-manager shows wrong time left and charge status:
For example:
Laptop-Accu is discharging (100%) (AC is plugged in - WRONG!)
Time left: not known

lshal output: see attachment lshal output
gnome-power-bugreport: see attachment g-pm bugreport output

----------------
Acer Aspire 1694
Gnome 2.22.0
HAL 0.5.10
Comment 19 Christoph Kindl 2008-04-07 07:44:34 UTC
Created attachment 108766 [details]
lshal output

lshal output
Comment 20 Christoph Kindl 2008-04-07 07:45:02 UTC
Created attachment 108767 [details]
g-pm bugreport output

gnome-power-bugreport output
Comment 21 Richard Hughes 2008-04-13 17:22:19 UTC
Cristoph, have you seen http://live.gnome.org/GnomePowerManager/FAQ?
Comment 22 Christoph Kindl 2008-04-13 18:42:09 UTC
Yes I have seen the FAQ before I posted here. What should I have seen? xD