Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 452356 - [PATCH] Same battery reported twice
Summary: [PATCH] Same battery reported twice
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: hal
Version: 10
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: ---
Assignee: David Zeuthen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-06-21 09:54 UTC by Chris Nolan
Modified: 2013-03-06 03:56 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-12-18 06:13:28 UTC


Attachments (Terms of Use)
hal-0.5.10-sysfs-battery-fixes.patch (deleted)
2008-07-08 16:20 UTC, Chris Nolan
no flags Details | Diff

Description Chris Nolan 2008-06-21 09:54:07 UTC
Description of problem:

Same battery is reported twice by HAL. Additionally, the "phantom" battery has
incorrect charge level values. From what I can work out, this only seems to
happen with kernel 2.6.25.x whereas 2.6.24.x was okay. Nonetheless, I believe
this is a HAL bug and not a kernel issue, but feel free to differ!

Version-Release number of selected component (if applicable):

hal-0.5.10-1.fc8.2
kernel-2.6.25.6-27.fc8

How reproducible:

Every time

Steps to Reproduce:
1. Boot laptop into current 2.6.25.x kernel
2. Gnome-power-manager reports two batteries, one with incorrect charge level
3. Do "lshal | grep -i bat" to see the problem
  
Actual results:

# lshal | grep -i bat
udi = '/org/freedesktop/Hal/devices/acpi_BAT0'
  battery.charge_level.capacity_state = 'ok'  (string)
  battery.charge_level.current = 29220  (0x7224)  (int)
  battery.charge_level.design = 50200  (0xc418)  (int)
  battery.charge_level.granularity_1 = 10  (0xa)  (int)
  battery.charge_level.granularity_2 = 10  (0xa)  (int)
  battery.charge_level.last_full = 49440  (0xc120)  (int)
  battery.charge_level.low = 100  (0x64)  (int)
  battery.charge_level.percentage = 59  (0x3b)  (int)
  battery.charge_level.rate = 19117  (0x4aad)  (int)
  battery.charge_level.unit = 'mWh'  (string)
  battery.charge_level.warning = 250  (0xfa)  (int)
  battery.is_rechargeable = true  (bool)
  battery.model = 'ASMB016'  (string)
  battery.present = true  (bool)
  battery.rechargeable.is_charging = false  (bool)
  battery.rechargeable.is_discharging = true  (bool)
  battery.remaining_time = 5502  (0x157e)  (int)
  battery.reporting.current = 29220  (0x7224)  (int)
  battery.reporting.design = 50200  (0xc418)  (int)
  battery.reporting.granularity_1 = 10  (0xa)  (int)
  battery.reporting.granularity_2 = 10  (0xa)  (int)
  battery.reporting.last_full = 49440  (0xc120)  (int)
  battery.reporting.low = 100  (0x64)  (int)
  battery.reporting.rate = 19117  (0x4aad)  (int)
  battery.reporting.technology = 'LION016'  (string)
  battery.reporting.unit = 'mWh'  (string)
  battery.reporting.warning = 250  (0xfa)  (int)
  battery.technology = 'unknown'  (string)
  battery.type = 'primary'  (string)
  battery.vendor = 'DPON016'  (string)
  battery.voltage.current = 11393  (0x2c81)  (int)
  battery.voltage.design = 10950  (0x2ac6)  (int)
  battery.voltage.unit = 'mV'  (string)
  info.capabilities = {'battery'} (string list)
  info.category = 'battery'  (string)
  info.product = 'Battery Bay'  (string)
  info.udi = '/org/freedesktop/Hal/devices/acpi_BAT0'  (string)
  linux.acpi_path = '/proc/acpi/battery/BAT0'  (string)
  battery.charge_level.current = 42800  (0xa730)  (int)
  battery.charge_level.last_full = 49440  (0xc120)  (int)
  battery.charge_level.percentage = 86  (0x56)  (int)
  battery.charge_level.rate = 0  (0x0)  (int)
  battery.current = 18064  (0x4690)  (int)
  battery.present = true  (bool)
  battery.rechargeable.is_charging = false  (bool)
  battery.rechargeable.is_discharging = true  (bool)
  battery.reporting.current = 42800  (0xa730)  (int)
  battery.reporting.design = 50200  (0xc418)  (int)
  battery.reporting.last_full = 49440  (0xc120)  (int)
  battery.reporting.technology = 'Unknown'  (string)
  battery.reporting.unit = 'mWh'  (string)
  battery.technology = 'unknown'  (string)
  battery.type = 'primary'  (string)
  battery.vendor = 'DPON016'  (string)
  battery.voltage.current = 12035  (0x2f03)  (int)
  info.capabilities = {'battery'} (string list)
  info.category = 'battery'  (string)
  linux.sysfs_path = '/sys/class/power_supply/BAT0'  (string)

Expected results:

Should only report one battery. Battery info in lshal should not be repeated!
Battery charge level for the "bogus" battery is incorrect and doesn't appear to
get updated.

Additional info:

Possible upstream fix here: 
http://bugs.freedesktop.org/show_bug.cgi?id=13669

Reported on various other distros:
http://bugs.gentoo.org/show_bug.cgi?id=203306
http://bugs.archlinux.org/task/9605
https://bugzilla.novell.com/show_bug.cgi?id=342808

The upstream fix doesn't appear to have made it into 0.5.10-3.fc8 from
updates-testing, hence this bug report.

Comment 1 Chris Nolan 2008-06-21 09:57:11 UTC
Very nice bug report here explaining the exact problem and the resolution:

http://bugs.archlinux.org/task/9572

Comment 2 Chris Nolan 2008-07-05 10:33:49 UTC
Patch found here from Kyle McMartin works for me (tested on F8, x86_64)

http://gitweb.freedesktop.org/?p=hal.git;a=commitdiff;h=4541abd23fd02118a1a7f8b825aed338d2a5d638

Comment 3 Ricardo Berlasso 2008-07-05 11:47:16 UTC
I have the same problem with my Fedora 8 64 bits. 
This is a big problem for people who needs to work "unplugged", because it is
not possible to determine the real battery state and programs like kpowersave
fails to do a proper job.

The output for lshal is:
~]$ lshal | grep -i bat
udi = '/org/freedesktop/Hal/devices/acpi_BAT1'
  battery.charge_level.capacity_state = 'ok'  (string)
  battery.charge_level.current = 44400  (0xad70)  (int)
  battery.charge_level.design = 44400  (0xad70)  (int)
  battery.charge_level.granularity_1 = 2930  (0xb72)  (int)
  battery.charge_level.granularity_2 = 41958  (0xa3e6)  (int)
  battery.charge_level.last_full = 44400  (0xad70)  (int)
  battery.charge_level.low = 1332  (0x534)  (int)
  battery.charge_level.percentage = 100  (0x64)  (int)
  battery.charge_level.rate = 0  (0x0)  (int)
  battery.charge_level.unit = 'mWh'  (string)
  battery.charge_level.warning = 4440  (0x1158)  (int)
  battery.is_rechargeable = true  (bool)
  battery.model = 'PA3536U '  (string)
  battery.present = true  (bool)
  battery.rechargeable.is_charging = false  (bool)
  battery.rechargeable.is_discharging = false  (bool)
  battery.reporting.current = 4000  (0xfa0)  (int)
  battery.reporting.design = 4000  (0xfa0)  (int)
  battery.reporting.granularity_1 = 264  (0x108)  (int)
  battery.reporting.granularity_2 = 3780  (0xec4)  (int)
  battery.reporting.last_full = 4000  (0xfa0)  (int)
  battery.reporting.low = 120  (0x78)  (int)
  battery.reporting.rate = 0  (0x0)  (int)
  battery.reporting.technology = 'Li-Ion'  (string)
  battery.reporting.unit = 'mAh'  (string)
  battery.reporting.warning = 400  (0x190)  (int)
  battery.serial = '3658Q'  (string)
  battery.technology = 'lithium-ion'  (string)
  battery.type = 'primary'  (string)
  battery.vendor = 'TOSHIBA'  (string)
  battery.voltage.current = 11100  (0x2b5c)  (int)
  battery.voltage.design = 11100  (0x2b5c)  (int)
  battery.voltage.unit = 'mV'  (string)
  info.capabilities = {'battery'} (string list)
  info.category = 'battery'  (string)
  info.product = 'Battery Bay'  (string)
  info.udi = '/org/freedesktop/Hal/devices/acpi_BAT1'  (string)
  linux.acpi_path = '/proc/acpi/battery/BAT1'  (string)
  battery.charge_level.current = 4000  (0xfa0)  (int)
  battery.charge_level.last_full = 4000  (0xfa0)  (int)
  battery.charge_level.percentage = 100  (0x64)  (int)
  battery.charge_level.rate = 0  (0x0)  (int)
  battery.current = 0  (0x0)  (int)
  battery.present = true  (bool)
  battery.rechargeable.is_charging = false  (bool)
  battery.rechargeable.is_discharging = false  (bool)
  battery.reporting.current = 4000  (0xfa0)  (int)
  battery.reporting.design = 4000  (0xfa0)  (int)
  battery.reporting.last_full = 4000  (0xfa0)  (int)
  battery.reporting.technology = 'Li-ion'  (string)
  battery.reporting.unit = 'mAh'  (string)
  battery.technology = 'lithium-ion'  (string)
  battery.type = 'primary'  (string)
  battery.vendor = 'TOSHIBA'  (string)
  battery.voltage.current = 11100  (0x2b5c)  (int)
  info.capabilities = {'battery'} (string list)
  info.category = 'battery'  (string)
  linux.sysfs_path = '/sys/class/power_supply/BAT1'  (string)


Comment 4 Chris Nolan 2008-07-08 16:20:43 UTC
Created attachment 311292 [details]
hal-0.5.10-sysfs-battery-fixes.patch

The patch I linked in the above post didn't fully resolve the problem - it
prevented battery being reported twice but didn't fix the problem with the
battery status not updating.

The attached patch addresses this issue. It is a flattened version of the
following patch:

http://bugs.gentoo.org/attachment.cgi?id=150331&action=view

I have tested this on x86_64 Fedora 8 (2.6.25.9-40.fc8) and it appears to work
100% correctly (gnome-power-manager now reports correct charge/discharge rates
and only one battery). 

This patch applies cleanly against hal-0.5.10-3 which is currently in
updates-testing.

Comment 5 Ricardo Berlasso 2008-09-14 10:03:36 UTC
I totally disagree with the severity label: if you ever needed to work un-plugged with your laptop (because you are travelling, for example, and need to end your work before arriving) you must recognize that this is a _hight_ priority problem.

Comment 6 Chris Nolan 2008-09-14 10:16:29 UTC
I think its pretty appalling that nobody from the fedora team has even responded to this report. Its a major bug, has been known about for many many months, and has been fixed in other distros for some time. 

I presume the patches have made it into the upstream hal but why haven't fedora released a pacthed hal for us?

For anyone that needs it, I made a patched RPM available here:

http://cenolan.com/fedora8/

There is also a patched SRPM there in case you need to build it for a different architecture.

Comment 7 W.C. Epperson 2008-09-15 02:01:33 UTC
Also in 2.6.26.3-14.fc8.  This is essentially the same bug as 373041, which was fixed at one point.

Comment 8 Bojan Smojver 2008-11-09 03:22:26 UTC
I see this with Dell Inspiron 6400 in F-10 preview.

It was fixed at one point (in F-8 or F-9, can't remember any more), but then came back in F-9 and it is still like this in F-10.

Comment 9 Chris Nolan 2008-11-09 14:31:41 UTC
AFAIK it never got fixed in F8 but is currently not a problem in F9. Not sure if it seems "fixed" in F9 because the kernel config is different or because HAL was actually fixed - I suspect the former but haven't looked into it. 

Regardless, still no response from the maintainers...

Comment 10 Bojan Smojver 2008-11-09 20:33:02 UTC
Actually, for me it is still a problem in F-9 as well on that same Dell Inspiron 6400.

I'm getting:
------------------------
$ hal-find-by-capability --capability "battery"
/org/freedesktop/Hal/devices/computer_power_supply_battery_BAT0_0
/org/freedesktop/Hal/devices/computer_power_supply_battery_BAT0
------------------------

And also:
------------------------
$ hal-find-by-capability --capability battery | xargs -n 1 hal-device
udi = '/org/freedesktop/Hal/devices/computer_power_supply_battery_BAT0_0'
  linux.sysfs_path = '/sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/power_supply/BAT0'  (string)
  battery.reporting.unit = 'mAh'  (string)
  battery.charge_level.last_full = 55411  (0xd873)  (int)
  info.subsystem = 'power_supply'  (string)
  info.parent = '/org/freedesktop/Hal/devices/computer'  (string)
  info.product = ' DELLUD2606'  (string)
  battery.serial = '853'  (string)
  battery.charge_level.design = 86580  (0x15234)  (int)
  info.category = 'battery'  (string)
  battery.present = true  (bool)
  battery.charge_level.rate = 11  (0xb)  (int)
  info.udi = '/org/freedesktop/Hal/devices/computer_power_supply_battery_BAT0_0'  (string)
  battery.type = 'primary'  (string)
  battery.voltage.current = 2649  (0xa59)  (int)
  battery.charge_level.percentage = 0  (0x0)  (int)
  battery.reporting.technology = 'Li-ion'  (string)
  battery.reporting.rate = 1  (0x1)  (int)
  info.capabilities = { 'battery' } (string list)
  battery.technology = 'lithium-ion'  (string)
  battery.is_rechargeable = true  (bool)
  linux.hotplug_type = 2  (0x2)  (int)
  battery.model = ' DELLUD2606'  (string)
  battery.rechargeable.is_charging = true  (bool)
  linux.subsystem = 'power_supply'  (string)
  battery.vendor = 'Sanyo'  (string)
  battery.rechargeable.is_discharging = false  (bool)
  battery.voltage.design = 11100  (0x2b5c)  (int)
  battery.reporting.current = 0  (0x0)  (int)
  battery.voltage.unit = 'mV'  (string)
  battery.reporting.last_full = 4992  (0x1380)  (int)
  battery.reporting.design = 7800  (0x1e78)  (int)
  battery.charge_level.current = 0  (0x0)  (int)

udi = '/org/freedesktop/Hal/devices/computer_power_supply_battery_BAT0'
  linux.sysfs_path = '/sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/power_supply/BAT0'  (string)
  battery.reporting.unit = 'mAh'  (string)
  battery.charge_level.last_full = 55411  (0xd873)  (int)
  info.subsystem = 'power_supply'  (string)
  info.parent = '/org/freedesktop/Hal/devices/computer'  (string)
  info.product = ' DELLUD2606'  (string)
  battery.serial = '853'  (string)
  battery.charge_level.design = 86580  (0x15234)  (int)
  info.category = 'battery'  (string)
  battery.present = true  (bool)
  battery.charge_level.rate = 11  (0xb)  (int)
  info.udi = '/org/freedesktop/Hal/devices/computer_power_supply_battery_BAT0'  (string)
  battery.type = 'primary'  (string)
  battery.voltage.current = 2649  (0xa59)  (int)
  battery.charge_level.percentage = 0  (0x0)  (int)
  battery.reporting.technology = 'Li-ion'  (string)
  battery.reporting.rate = 1  (0x1)  (int)
  info.capabilities = { 'battery' } (string list)
  battery.technology = 'lithium-ion'  (string)
  battery.is_rechargeable = true  (bool)
  linux.hotplug_type = 2  (0x2)  (int)
  battery.model = ' DELLUD2606'  (string)
  battery.rechargeable.is_charging = true  (bool)
  linux.subsystem = 'power_supply'  (string)
  battery.vendor = 'Sanyo'  (string)
  battery.rechargeable.is_discharging = false  (bool)
  battery.voltage.design = 11100  (0x2b5c)  (int)
  battery.reporting.current = 0  (0x0)  (int)
  battery.voltage.unit = 'mV'  (string)
  battery.reporting.last_full = 4992  (0x1380)  (int)
  battery.reporting.design = 7800  (0x1e78)  (int)
  battery.charge_level.current = 0  (0x0)  (int)
------------------------

I only have one battery in that machine.

Comment 11 Bojan Smojver 2008-11-20 22:38:47 UTC
Same with kernel-2.6.27.5-41.fc9.i686.

Comment 12 Bug Zapper 2008-11-26 10:54:20 UTC
This message is a reminder that Fedora 8 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 8.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '8'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 8's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 8 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 13 Bojan Smojver 2008-11-26 20:25:00 UTC
I'm going to rebase this to 10, although I see it in both 9 and 10 still.

Comment 14 Scott Glaser 2009-09-09 11:56:44 UTC
Have you tried with the latest hal package in Fedora 10, Fedora 11 or tried Rawhide? In any case, can you let us know whether the issue is still happening, and give the current version of the HAL packages you're using?

-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers

Comment 15 Bojan Smojver 2009-09-11 08:16:38 UTC
I haven't seen this on my notebook for a while (F-11), but then again, this is one of those come and go things.

Comment 16 Bug Zapper 2009-11-18 10:13:39 UTC
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 10 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 17 Bug Zapper 2009-12-18 06:13:28 UTC
Fedora 10 changed to end-of-life (EOL) status on 2009-12-17. Fedora 10 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.