[hardy] two batteries display when left clicking on g-p-m

Bug #177570 reported by Brian Murray on 2007-12-19
168
This bug affects 2 people
Affects Status Importance Assigned to Milestone
HAL
Fix Released
Medium
gnome-power-manager (Ubuntu)
Undecided
Unassigned
Hardy
Undecided
Unassigned
hal (Ubuntu)
Medium
Martin Pitt
Hardy
Medium
Martin Pitt

Bug Description

Binary package hint: gnome-power-manager

While I only have one battery in my laptop as indicated by:

ls /proc/acpi/battery/
BAT0

When I left click on gnome-power-manager I see two batteries. They also show different percent fullness. Additionally, if I disconnect my AC adapter the mysterious second battery still shows being plugged in.

Related branches

Created an attachment (id=13124)
lshal

Created an attachment (id=13125)
kernel config

I already know that and work on a solution ...

Brian Murray (brian-murray) wrote :

Binary package hint: gnome-power-manager

While I only have one battery in my laptop as indicated by:

ls /proc/acpi/battery/
BAT0

When I left click on gnome-power-manager I see two batteries. They also show different percent fullness. Additionally, if I disconnect my AC adapter the mysterious second battery still shows being plugged in.

Brian Murray (brian-murray) wrote :
Ted Gould (ted) wrote :

Could you please run this command to see how many batteries HAL thinks you have:

$ hal-find-by-capability --capability "battery"

If two are reported, this is a HAL bug.

Changed in gnome-power-manager:
status: New → Incomplete
Albert Damen (albrt) wrote :

On my laptop the two battery symbols are also shown, but give different information. One is the real battery, product battery-bay, with a capacity of 80 Wh. The second is a small battery, product li-ion, with a capacity of 7,2 Wh. This second battery seems to be the battery feeding the bios settings RAM.
ls /proc/acpi/battery also shows one battery, BAT1 in my case.
(Hardy AMD64 2.6.24)

Brian Murray (brian-murray) wrote :

bdmurray@wonderwoman:~$ hal-find-by-capability --capability "battery"
/org/freedesktop/Hal/devices/acpi_BAT0
/org/freedesktop/Hal/devices/computer_power_supply_0

On Thu, 2007-12-20 at 00:03 +0000, Brian Murray wrote:
> bdmurray@wonderwoman:~$ hal-find-by-capability --capability "battery"
> /org/freedesktop/Hal/devices/acpi_BAT0
> /org/freedesktop/Hal/devices/computer_power_supply_0

Could you please dump the properties of those two devices so that I can
get more information on them?

$ hal-find-by-capability --capability battery | xargs -n 1 hal-device

Thanks,
Ted

Roland Dreier (roland.dreier) wrote :
Download full text (3.9 KiB)

This seems to be a known issue with kernel 2.6.24-rc's and hal; see for example http://lkml.org/lkml/2007/12/8/24 and
https://bugzilla.novell.com/show_bug.cgi?id=342808

Since kernel 2.6.24 has recently gone into Hardy, it's not surprising this is now showing up.

Anyway, here's the hal-device output:

$ hal-find-by-capability --capability battery | xargs -n 1 hal-device
udi = '/org/freedesktop/Hal/devices/computer_power_supply_0'
  battery.type = 'primary' (string)
  battery.present = true (bool)
  battery.current = 48047 (0xbbaf) (int)
  battery.rechargeable.is_charging = true (bool)
  battery.charge_level.percentage = 5 (0x5) (int)
  battery.technology = 'lithium-ion' (string)
  info.capabilities = { 'battery' } (string list)
  info.udi = '/org/freedesktop/Hal/devices/computer_power_supply_0' (string)
  battery.reporting.technology = 'Li-ion' (string)
  battery.vendor = 'SANYO' (string)
  battery.reporting.last_full = 78800 (0x133d0) (int)
  linux.subsystem = 'power_supply' (string)
  battery.reporting.design = 74880 (0x12480) (int)
  battery.reporting.unit = 'mWh' (string)
  battery.charge_level.rate = 0 (0x0) (int)
  battery.remaining_time = 6164 (0x1814) (int)
  info.product = 'Li-ion' (string)
  linux.hotplug_type = 2 (0x2) (int)
  linux.sysfs_path = '/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0' (string)
  battery.voltage.current = 15915 (0x3e2b) (int)
  info.category = 'battery' (string)
  battery.reporting.current = 3950 (0xf6e) (int)
  battery.charge_level.current = 3950 (0xf6e) (int)
  battery.charge_level.last_full = 78800 (0x133d0) (int)
  info.parent = '/org/freedesktop/Hal/devices/computer' (string)
  battery.rechargeable.is_discharging = false (bool)

udi = '/org/freedesktop/Hal/devices/acpi_BAT0'
  info.parent = '/org/freedesktop/Hal/devices/computer' (string)
  info.product = 'Battery Bay' (string)
  battery.technology = 'lithium-ion' (string)
  info.capabilities = { 'battery' } (string list)
  info.udi = '/org/freedesktop/Hal/devices/acpi_BAT0' (string)
  battery.charge_level.low = 200 (0xc8) (int)
  battery.alarm.unit = 'mWh' (string)
  battery.reporting.current = 7310 (0x1c8e) (int)
  battery.vendor = 'SANYO' (string)
  battery.rechargeable.is_discharging = false (bool)
  battery.model = '42T4506' (string)
  battery.reporting.last_full = 78800 (0x133d0) (int)
  battery.reporting.design = 74880 (0x12480) (int)
  battery.reporting.warning = 3940 (0xf64) (int)
  battery.charge_level.rate = 44649 (0xae69) (int)
  battery.reporting.low = 200 (0xc8) (int)
  battery.charge_level.capacity_state = 'ok' (string)
  battery.charge_level.current = 7310 (0x1c8e) (int)
  battery.charge_level.last_full = 78800 (0x133d0) (int)
  linux.hotplug_type = 4 (0x4) (int)
  battery.type = 'primary' (string)
  battery.serial = '1859' (string)
  battery.voltage.design = 14400 (0x3840) (int)
  battery.charge_level.design = 74880 (0x12480) (int)
  battery.charge_level.unit = 'mWh' (string)
  battery.voltage.current = 15935 (0x3e3f) (int)
  linux.acpi_type = 0 (0x0) (int)
  battery.present = true (bool)
  linux.acpi_path = '...

Read more...

Martijn vdS (martijn) wrote :

I see four batteries while I have two.

hal-find-by-capability tells me:
/org/freedesktop/Hal/devices/acpi_C178
/org/freedesktop/Hal/devices/acpi_C177
/org/freedesktop/Hal/devices/computer_power_supply_1
/org/freedesktop/Hal/devices/computer_power_supply_0

So this is probably a HAL bug.

Martijn vdS (martijn) wrote :
Download full text (6.6 KiB)

udi = '/org/freedesktop/Hal/devices/acpi_C178'
  battery.serial = '11206' (string)
  info.capabilities = { 'battery' } (string list)
  battery.charge_level.warning = 2419 (0x973) (int)
  info.category = 'battery' (string)
  info.product = 'Battery Bay' (string)
  battery.technology = 'lithium-ion' (string)
  battery.reporting.warning = 168 (0xa8) (int)
  battery.model = 'Primary' (string)
  battery.rechargeable.is_discharging = false (bool)
  battery.charge_level.granularity_1 = 1440 (0x5a0) (int)
  battery.charge_level.granularity_2 = 1440 (0x5a0) (int)
  linux.acpi_path = '/proc/acpi/battery/C178' (string)
  battery.charge_level.current = 47260 (0xb89c) (int)
  battery.charge_level.design = 48384 (0xbd00) (int)
  battery.charge_level.low = 489 (0x1e9) (int)
  battery.reporting.last_full = 3360 (0xd20) (int)
  battery.reporting.technology = 'LIon' (string)
  battery.reporting.granularity_1 = 100 (0x64) (int)
  battery.is_rechargeable = true (bool)
  battery.reporting.granularity_2 = 100 (0x64) (int)
  battery.reporting.current = 3282 (0xcd2) (int)
  battery.voltage.unit = 'mV' (string)
  battery.charge_level.capacity_state = 'ok' (string)
  info.parent = '/org/freedesktop/Hal/devices/computer' (string)
  battery.rechargeable.is_charging = false (bool)
  battery.reporting.rate = 0 (0x0) (int)
  battery.charge_level.rate = 0 (0x0) (int)
  battery.reporting.design = 3360 (0xd20) (int)
  battery.present = true (bool)
  info.udi = '/org/freedesktop/Hal/devices/acpi_C178' (string)
  linux.acpi_type = 0 (0x0) (int)
  battery.voltage.design = 14400 (0x3840) (int)
  battery.reporting.low = 34 (0x22) (int)
  battery.type = 'primary' (string)
  battery.charge_level.last_full = 48384 (0xbd00) (int)
  battery.reporting.unit = 'mAh' (string)
  battery.voltage.current = 15434 (0x3c4a) (int)
  battery.charge_level.percentage = 97 (0x61) (int)
  battery.vendor = 'Hewlett-Packard' (string)
  linux.hotplug_type = 4 (0x4) (int)
  battery.charge_level.unit = 'mWh' (string)

udi = '/org/freedesktop/Hal/devices/acpi_C177'
  battery.serial = '00505' (string)
  info.capabilities = { 'battery' } (string list)
  battery.charge_level.warning = 2205 (0x89d) (int)
  info.category = 'battery' (string)
  info.product = 'Battery Bay' (string)
  battery.technology = 'lithium-ion' (string)
  battery.reporting.warning = 149 (0x95) (int)
  battery.model = 'Travel' (string)
  battery.rechargeable.is_discharging = false (bool)
  battery.charge_level.granularity_1 = 1480 (0x5c8) (int)
  battery.charge_level.granularity_2 = 1480 (0x5c8) (int)
  linux.acpi_path = '/proc/acpi/battery/C177' (string)
  battery.charge_level.current = 43956 (0xabb4) (int)
  battery.charge_level.design = 43956 (0xabb4) (int)
  battery.charge_level.low = 444 (0x1bc) (int)
  battery.reporting.last_full = 2970 (0xb9a) (int)
  battery.reporting.technology = 'LIon' (string)
  battery.reporting.granularity_1 = 100 (0x64) (int)
  battery.is_rechargeable = true (bool)
  battery.reporting.granularity_2 = 100 (0x64) (int)
  battery.reporting.current = 2970 (0xb9a) (int)
  battery.voltage.unit = 'mV' (string)
  battery.charg...

Read more...

Changed in gnome-power-manager:
status: Incomplete → Confirmed
Changed in hal:
importance: Undecided → Medium
status: New → Confirmed
Martin (martin-o) wrote :

There is an upstream report concerning this here:
https://bugs.freedesktop.org/show_bug.cgi?id=13669

Changed in hal:
status: Unknown → Confirmed
Luka Renko (lure) wrote :

I have same problem on my HP nw8240 running Kubuntu Hardy. I have two batteries, but HAL reports four. If I compare it with gutsy where I get only these two:
/org/freedesktop/Hal/devices/acpi_C178
/org/freedesktop/Hal/devices/acpi_C177

On hardy I get additional two:
/org/freedesktop/Hal/devices/computer_power_supply_1
/org/freedesktop/Hal/devices/computer_power_supply_0

lshal output attached.

Download full text (3.5 KiB)

udi = '/org/freedesktop/Hal/devices/acpi_BAT1'
  info.capabilities = { 'battery' } (string list)
  battery.charge_level.warning = 0 (0x0) (int)
  info.category = 'battery' (string)
  info.product = 'Battery Bay' (string)
  battery.technology = 'lithium-ion' (string)
  battery.reporting.warning = 0 (0x0) (int)
  battery.rechargeable.is_discharging = false (bool)
  battery.model = 'MS-1058' (string)
  battery.charge_level.granularity_1 = 14 (0xe) (int)
  battery.charge_level.granularity_2 = 14 (0xe) (int)
  linux.acpi_path = '/proc/acpi/battery/BAT1' (string)
  battery.charge_level.current = 0 (0x0) (int)
  battery.charge_level.design = 65120 (0xfe60) (int)
  battery.charge_level.low = 0 (0x0) (int)
  battery.reporting.last_full = 3618 (0xe22) (int)
  battery.reporting.technology = 'LION' (string)
  battery.reporting.granularity_1 = 1 (0x1) (int)
  battery.is_rechargeable = true (bool)
  battery.reporting.granularity_2 = 1 (0x1) (int)
  battery.reporting.current = 0 (0x0) (int)
  battery.voltage.unit = 'mV' (string)
  battery.charge_level.capacity_state = 'ok' (string)
  info.parent = '/org/freedesktop/Hal/devices/computer' (string)
  battery.rechargeable.is_charging = false (bool)
  battery.reporting.rate = 0 (0x0) (int)
  battery.charge_level.rate = 0 (0x0) (int)
  battery.reporting.design = 4400 (0x1130) (int)
  battery.present = true (bool)
  info.udi = '/org/freedesktop/Hal/devices/acpi_BAT1' (string)
  linux.acpi_type = 0 (0x0) (int)
  battery.voltage.design = 14800 (0x39d0) (int)
  battery.reporting.low = 0 (0x0) (int)
  battery.type = 'primary' (string)
  battery.charge_level.last_full = 36180 (0x8d54) (int)
  battery.reporting.unit = 'mAh' (string)
  battery.voltage.current = 10000 (0x2710) (int)
  battery.charge_level.percentage = 100 (0x64) (int)
  battery.vendor = 'MSI' (string)
  linux.hotplug_type = 4 (0x4) (int)
  battery.charge_level.unit = 'mWh' (string)

udi = '/org/freedesktop/Hal/devices/computer_power_supply_0'
  battery.type = 'primary' (string)
  battery.present = true (bool)
  battery.current = -1 (0xffffffff) (int)
  battery.rechargeable.is_charging = false (bool)
  battery.charge_level.percentage = 100 (0x64) (int)
  battery.technology = 'unknown' (string)
  info.capabilities = { 'battery' } (string list)
  info.udi = '/org/freedesktop/Hal/devices/computer_power_supply_0' (string)
  battery.reporting.technology = 'Unknown' (string)
  battery.vendor = 'MSI Corp.' (string)
  battery.reporting.last_full = 3618 (0xe22) (int)
  linux.subsystem = 'power_supply' (string)
  battery.reporting.design = 4400 (0x1130) (int)
  battery.reporting.unit = 'mAh' (string)
  battery.charge_level.rate = 0 (0x0) (int)
  info.product = 'Unknown' (string)
  linux.hotplug_type = 2 (0x2) (int)
  linux.sysfs_path = '/sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:14/PNP0C09:00/PNP0C0A:00/power_supply/BAT1' (string)
  battery.voltage.current = 10000 (0x2710) (int)
  info.category = 'battery' (string)
  battery.reporting.current = -1 (0xffffffff) (int)
  battery.charge_level.current = 0 (0x0) (int)
  battery.charge_level.last_full = 3618 (0xe22) (int)
...

Read more...

Luka Renko (lure) wrote :

Not gnome-power-manager bug, but issue in HAL.

Changed in gnome-power-manager:
status: Confirmed → Invalid
Dana Goyette (danagoyette) wrote :

Comments copied (and fixed) from my bug report LP: 181101:

The old interface is through the ACPI 'battery' module, and shows up as product "Battery Bay". The new interface is through the 'power_supply' module, and shows up as product 'Li-ion'.

The old battery interface disappears upon removal; the new interface indicates 0% and 'missing' instead.

The new interface seems not to emit 'change' events to HAL (as seen in lshal --monitor), so the value is not updated except on state changes.

In addition, this duplication of battery seems to halve gnome-power-manager's indicated wattage, but the ACPI power usage value given by powertop seems unaffected.

Thankfully, this didn't see, to affect gnome-power-manager's battery-life estimates, but I would imagine having these duplicate batteries, one of which never changes, can screw up any existing battery profiles.
Ideally, once the lack of events is fixed there should be a way to detect duplicates, perhaps by having the power_supply sysfs class keep a link to the /proc battery object.

Actually this bug prevent gnome-power-manager to shutdown or hibernate the system if the battery goes out of power but I think it should be the normal behavior of gnome-power-manager.

This problem is in HAL, as it also affects kde's power manager.

$ hal-find-by-capability --capability "battery"
/org/freedesktop/Hal/devices/acpi_BAT0
/org/freedesktop/Hal/devices/computer_power_supply_0

Stefan Skotte (screemo) wrote :

I can confirm this issue too, on a Thinkpad T61p with one 9cell battery.

$ hal-find-by-capability --capability "battery"
/org/freedesktop/Hal/devices/acpi_BAT0
/org/freedesktop/Hal/devices/computer_power_supply_0

linuxatico88 (simo88-47) wrote :

yet another confirm...here's the output of my pavilion dv2570el (only one battery)

$ hal-find-by-capability --capability "battery"
/org/freedesktop/Hal/devices/acpi_BAT0
/org/freedesktop/Hal/devices/computer_power_supply_0

Brian Murray (brian-murray) wrote :

There is no need to confirm the bug report multiple times. Each additional comment sends e-mail to every subscriber of the bug which can be bothersome. Additionally, this bug has already been forwarded upstream as indicated by the Affects HAL bit at the top of the bug report and a solution is being worked on. Thanks for your cooperation.

Luka Renko (lure) wrote :

Bug seems to have now proper fix for HAL:
http://dkukawka.blogspot.com/2008/01/hal-sysfs-acpi-batteries-fixed.html

Can we include this in Ubuntu Hardy?

The kernel is being built with CONFIG_ACPI_BATTERY and CONFIG_POWER_SUPPLY defined. Either use the old or the new interface, but not both. If you have to use both, please use the patch listed above so hal ignores the duplicate.

Jerone Young (jerone) wrote :

Yeap just tested latest HAL in git and it does solve this issue.

C Anthony Risinger (extofme) wrote :

mine also shows two batteries as some have already confirmed.

however, it is interesting to note that on the live cd i started with two batteries, but by the end of the install power-manager was reporting six separate batteries, all with different charges.

Jerone Young (jerone) wrote :

This is fixed, but there has not been a HAL release cut with the fix. It is in git so you can go here and compile HAL and see that it now does work as it should (showing the right amount of battrie(s)).

If you want to see this fixed run these commands:

1) sudo apt-get install git-core build-essential
2) sudo apt-get build-dep hal
3) git clone git://anongit.freedesktop.org/git/hal
* Now go into "hal" dir
4) ./autogen.sh --prefix=/usr
5) make
6) sudo make install
* Now reboot your machine and log back in. You will see the battery is now reporting right again.

John Dong (jdong) wrote :

ok, *PLEASE* keep this bug report on track, that is, identifying the cause and fix for this bug as it pertains to Ubuntu development. This is not the place to tell people how to work around bugs in ways that do not help the developers fix this bug. Please take those discussions to the forums, mailing lists, or IRC channels, where you're more than welcome to discuss this aspects of this bug.

For this bug, the two fixes have been identified -- either changing the kernel config or pulling this patch from hal's git. The next "beneficial" thing someone can do is identify the Git changeset that fixed this bug, or even to isolate it out into a patch and/or debdiff.

I talked to Matthew Garrett about this bug yesterday and he says once he gets back in town next week, he will look into it.

Craig Huffstetler (xq) wrote :

This is happening to me as well.

When I add a secondary battery on my laptop via ACPI Hotplug (with or without restarting) it displays double of it as well.

So when I have two battery sources -- Ubuntu-Gnome-Power-Manager in Hardy displays FOUR Batteries instead of Two Batteries (like it actually has). This problem never occurred in any previous releases of Ubuntu.

Command output:

craig@zen:~$ hal-find-by-capability --capability "battery"
/org/freedesktop/Hal/devices/acpi_BAT0
/org/freedesktop/Hal/devices/acpi_BAT1
/org/freedesktop/Hal/devices/computer_power_supply_1
/org/freedesktop/Hal/devices/computer_power_supply_0
/org/freedesktop/Hal/devices/usb_device_46d_c510_noserial
craig@zen:~$

Craig Huffstetler (xq) wrote :

Just for your notes:

https://bugs.freedesktop.org/show_bug.cgi?id=13669
Seems to have addressed this issue in Fedora rawhide with:
http://gitweb.freedesktop.org/?p=hal.git;a=commitdiff;h=4541abd23fd02118a1a7f8b825aed338d2a5d638

Sincerely,

Craig Huffstetler / xq

John Dong (jdong) wrote :

This is a debdiff against Hardy of patch http://gitweb.freedesktop.org/?p=hal.git;a=commitdiff_plain;h=4541abd23fd02118a1a7f8b825aed338d2a5d638;hp=e3eb726da49a8cdc9e93905777a6e2d71ae878b3 as xq linked above.

I'd like Matthew Garrett's blessing on this first, though.

John Dong (jdong) wrote :

That patch is no good; on my macbook it always show the battery as plugged in.

Luka Renko (lure) wrote :

Yes, this was discussed on HAL mailing list: new /sys interface is not as reliable as old /proc interface in some cases. I think somebody need to evaluate benefits of going with new /sys interface. Currently it more looks like it would be safer to stay with /proc....

Craig Huffstetler (xq) wrote :

This is even more worrisome than I thought. Last night this bug threw my laptop into a full blown panic.

Even though I have TWO batteries plugged in and working (one was at 100%) and my primary battery hit 0%...my system started the emergency beeping sound and would not stop. It then SHUT DOWN without ever utilizing the secondary battery.

When I turned it back on and tried to boot into Linux, it would not get past booting up.

When I selected Windows at the GRUB screen, it booted up into Windows fine and used the second battery....

Is this all related? If so, I think this bug should be escalated in priority from medium to high.

xq

John Dong (jdong) wrote :

I don't think that's related to this issue, xq...

As far as proc vs sys, now the question is what's the "best" fix for that. I'd like to say that they should be equivalent and sysfs should be fixed to properly detect laptop battery status (also sysfs seems to not live-update the discharge rate, only take one reading on HAL startup)

Regardless of the priority, I think it's fairly certain this WILL be fixed before Hardy ships but I don't know enough about HAL and power management to know what solution is best. Let's all sit tight and wait for someone like mjg59 to weigh in on this when he gets back :)

Sebastien Bacher (seb128) wrote :

The bug has been fixed upstream now

Changed in hal:
milestone: none → ubuntu-8.04
status: Confirmed → Fix Committed

The OP mentioned two problems, that patch seems to fix the first one, but does it really solve the second problem:

>It also seems that using the new kernel API, the state of the battery is not
>updated properly.

Jerone Young (jerone) wrote :

Yes the problem has been fixed upstream (as I have tested with upstream hal and seen this go away). But the hal package in hardy (0.5.10-4ubunt6) does not fix this issue. I am using a fully update machine with all the latest hardy packages as of today (the 18th of Febuary) and it appears that everything that was need to fix this issue in hal was not included.

I shouldn't be the only one seeing this now ?? Is it somehow fixed for everyone else ?? Maybe I need to do a fresh clean install if this is the case. Using a Thinkpad T61p.

Jerone Young (jerone) wrote :

Hal package 0.5.10-5ubuntu6 does not resolve this issue.

Changed in hal:
status: Fix Committed → Incomplete
Martin Emrich (emme) wrote :

Jerone, "Fix committed" is not "Fix released", so there are not yet updated packages in the repositories.
And yes, I still see this error on my notebook.

Andrew Conkling (andrewski) wrote :

Yes, please be sure of the status before you change them.

Changed in hal:
status: Incomplete → Fix Committed
John Dong (jdong) wrote :

No, the status for hal's Ubuntu package should not be fix committed unless it's in the staging area of a packager or the VCS for hal's packaging in Ubuntu, pending immediate upload.

The Fix Committed status should be appliked to HAL upstream if anything. This is consistent with recent discussions in IRC regarding the use of the Fix Committed status.

Changed in hal:
status: Fix Committed → Triaged
Andrew Conkling (andrewski) wrote :

I just was reverting it back to Sebastian's change since I assumed he knew something about this (e.g. an Ubuntu-specific patch that hadn't made it upstream).

Martin Pitt (pitti) on 2008-02-20
Changed in hal:
assignee: nobody → pitti
status: Triaged → In Progress
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package hal - 0.5.10-5ubuntu7

---------------
hal (0.5.10-5ubuntu7) hardy; urgency=low

  * Add debian/patches/95_virtual_net_devices.patch: Include virtual network
    devices which do not have a physical parent. Thanks to Kees Cook for the
    patch.
  * Add debian/patches/01_proc_sys_batteries.patch: Fix showing batteries
    twice. Taken from upstream git head, see patch header for details.
    (LP: #177570)

 -- Martin Pitt <email address hidden> Wed, 20 Feb 2008 12:09:48 +0100

Changed in hal:
status: In Progress → Fix Released

The new package causes other problems for me. I have filed a new bug (bug 194052). Please confirm if you see the same!

James Ward (jamesward) wrote :

This is fixed for me. I now only see one battery. Thanks!

John Dong (jdong) wrote :

Perhaps now this is a kernel bug, but the battery percentage gets stuck at X% while discharging and even still shows being hooked up to AC despite that not being true.

Sysfs power supplies are not working well for me.

Albert Damen (albrt) wrote :

The fix works in the sense I only see one battery now. However, it is the wrong "battery"!
$ hal-find-by-capability --capability "battery"
/org/freedesktop/Hal/devices/computer_power_supply_0

This "battery" shows a capacity of 7,2 Wh. The real battery has a capacity of 80 Wh.

Output of hal-find-by-capability --capability battery | xargs -n 1 hal-device > battery_info is attached.

$ dpkg -s hal | grep Version
Version: 0.5.10-5ubuntu7

Craig Huffstetler (xq) wrote :

Confirmed...not exactly "fixed." It's the wrong battery information that is being displayed.

$ dpkg -s hal | grep Version
Version: 0.5.10-5ubuntu7

Andrew Conkling (andrewski) wrote :

Reopening based on multiple reports of incorrect battery being listed. Sounds like we're not quite there yet....

Changed in hal:
status: Fix Released → Confirmed
Martin Pitt (pitti) wrote :

Please file new reports for new bugs. The double battery issue is confirmed fixed.

Changed in hal:
status: Confirmed → Fix Released

> Please file new reports for new bugs. The double battery issue is confirmed fixed.
Indeed, as I mentioned a few comments back, people should take a look at bug 194052 in order to help finding a solution to what I think is a common problem for all of us.

(In reply to comment #5)
> The OP mentioned two problems, that patch seems to fix the first one, but does
> it really solve the second problem:
>
> >It also seems that using the new kernel API, the state of the battery is not
> >updated properly.
>

if lshal | grep -i bat should display current battery values, it is wrong.

lshal | grep -i bat shows different values from sysfs interface.

I noticed that these values get reloaded at an acpi event (reloaded by hal, directory content is updated on the fly).

This all is fixed. Since the kernel send no signal if the battery values change (because the values get read from the hardware and set in sysfs in the moment you read a file there) HAL do the same as before with proc: read battery values every 30 seconds which is often enough.

There is evidence gathered by Daniel T Chen that this bug still exists. We're discussing this here: https://bugs.edge.launchpad.net/ubuntu/+source/hal/+bug/194719
where you can also find log reports.

Changed in hal:
status: Confirmed → Fix Released

To be clear WRT Sense's comment above, the symptom described in the title of /this/ bug report is resolved by the changeset referenced in comment #4, but as comment #5 states, the battery state is not updated from sysfs properly.

(Noted that these symptoms are fixed in hal.git but not in Ubuntu Hardy's current hal source package. Adjusting Ubuntu bugs as per necessary. Sorry for the noise, thanks!)

(In reply to comment #7)
> This all is fixed. Since the kernel send no signal if the battery values change
> (because the values get read from the hardware and set in sysfs in the moment
> you read a file there) HAL do the same as before with proc: read battery values
> every 30 seconds which is often enough.
>

I think you should consider to make the poll interval configurable or put some heuristics, e.g., poll every 2 minutes when battery is above 50%, poll every 1 minute when battery is above 10% and poll every 10 seconds otherwise.

there is a typo in hal-0.5.10/hald/linux/device.c

line 3181:

/* CURRENT: we prefer the average if it exists, although present is still pretty good */
        if (!hal_util_get_int_from_file (path, "current_avg", &current, 10)) {

should be:

/* CURRENT: we prefer the average if it exists, although present is still pretty good */
        if (hal_util_get_int_from_file (path, "current_avg", &current, 10)) {

(i.e., negate the condition otherwise rate is not ever updated.)

(In reply to comment #11)
> I think you should consider to make the poll interval configurable or put some
> heuristics, e.g., poll every 2 minutes when battery is above 50%, poll every 1
> minute when battery is above 10% and poll every 10 seconds otherwise.

No, we don't make the interval configurable and we also don't change the interval depending on the situation. We use 30 sec. as we did already since ages. This interval was never a problem. To poll more often cause battery power, since there are machines where this need CPU power. Polling less often only lead to less interactivity for the user and possibly more unreliable remaining percentage and specially remaining time.

I/we work since several years on powermanagement under linux and the 30 sec. interval is IMO the best compromise.

(In reply to comment #12)
> there is a typo in hal-0.5.10/hald/linux/device.c
[...]
> /* CURRENT: we prefer the average if it exists, although present is still
> pretty good */
> if (hal_util_get_int_from_file (path, "current_avg", &current, 10)) {
>
> (i.e., negate the condition otherwise rate is not ever updated.)

I take a look at this issue.

Changed in hal:
status: Fix Released → Confirmed

the change has broken the GetBrightness calls on dell latitude laptops, bug #14797 is about the issue

(In reply to comment #14)
> (In reply to comment #12)
[...]
> > (i.e., negate the condition otherwise rate is not ever updated.)
>
> I take a look at this issue.

This was already fixed (2008-02-05). Close the bug now.

Martin Pitt (pitti) wrote :

Can you please all try my newly proposed version in my PPA? https://launchpad.net/~pitti/+archive

I think that finally gets it right. Please report back here. Thank you!

Ah, I'm glad we're finally building it from git, 0.5.10 is really not on par with the latest changes.
Will try it now and get back later.

Changed in hal:
status: Confirmed → Fix Released

On Wed, Mar 5, 2008 at 5:24 AM, Martin Pitt <email address hidden> wrote:

> Can you please all try my newly proposed version in my PPA?
> <https://launchpad.net/%7Epitti/+archive>
> I think that finally gets it right. Please report back here. Thank you!
>

I don't know what changes are in this version, but this package also seems
to work fine.

>Will try it now and get back later.
Woops, forgot to get back, but I forgot because everything worked just fine :-)
Thanks for the update!

The bug has appeared on my laptop with Intrepid installed (with Wubi): Two batteries are being shown.

$ 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

Brian Murray (brian-murray) wrote :

devildante - Could you please submit a new bug report regarding your issue as it may be specific to the Wubi environment? I don't see this behavior in Intrepid. In your new bug report please include the information requested by Ted Gould in comments 2 and 5 of this report and feel free to subscribe me to the new bug. Thanks in advance.

Changed in hal:
importance: Unknown → Medium
Changed in hal:
importance: Medium → Unknown
Changed in hal:
importance: Unknown → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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