Bug 144692 - kpowersave too pessimistic about battery
Summary: kpowersave too pessimistic about battery
Status: RESOLVED WONTFIX
Alias: None
Product: SUSE Linux 10.1
Classification: openSUSE
Component: Mobile Devices (show other bugs)
Version: Beta 1
Hardware: Other Other
: P5 - None : Minor (vote)
Target Milestone: ---
Assignee: Danny Kukawka
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-22 22:20 UTC by Christian Boltz
Modified: 2006-02-03 06:34 UTC (History)
1 user (show)

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
lshat and powersave -B output (2.35 KB, text/plain)
2006-02-01 13:32 UTC, Robert Bergelin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Boltz 2006-01-22 22:20:11 UTC
kpowersave is too pessimistic about my battery.

kpowersave says "95%, 0:43 h remaining"
but my battery usually lasts about 4 h

Hardware: Acer TravelMate 803 laptop


Contents of /proc/acpi/battery/BAT1/ (no second battery installed):

==> alarm <==
alarm:                   unsupported

==> info <==
present:                 yes
design capacity:         4400 mAh
last full capacity:      3812 mAh
battery technology:      rechargeable
design voltage:          14800 mV
design capacity warning: 250 mAh
design capacity low:     100 mAh
capacity granularity 1:  10 mAh
capacity granularity 2:  25 mAh
model number:            03ZG
serial number:
battery type:            LION
OEM info:                SANYO

==> state <==
present:                 yes
capacity state:          ok
charging state:          discharging
present rate:            0 mA
remaining capacity:      3645 mAh
present voltage:         9152 mV
Comment 1 Timo Hoenig 2006-01-26 23:26:33 UTC
cc'ing Holger as he might want to comment this.
Comment 2 Holger Macht 2006-01-27 09:53:11 UTC
The remaining battery time comes from hal, so maybe its calculation has to be adjusted a little bit. Can you please post the output of 'lshal | grep battery'?
Comment 3 Christian Boltz 2006-01-28 20:49:55 UTC
Here's the requested output (grep -C5 to make it complete).

When querying this, power was not plugged in and the laptop freshly booted with battery fully loaded.

udi = '/org/freedesktop/Hal/devices/acpi_BAT1'
  battery.remaining_time = 221  (0xdd)  (int)
  info.udi = '/org/freedesktop/Hal/devices/acpi_BAT1'  (string)
  linux.hotplug_type = 4  (0x4)  (int)
  battery.charge_level.percentage = 98  (0x62)  (int)
  battery.charge_level.rate = 0  (0x0)  (int)
  battery.charge_level.last_full = 53916928  (0x336b500)  (int)
  battery.charge_level.current = 53082432  (0x329f940)  (int)
  battery.voltage.current = 14144  (0x3740)  (int)
  battery.reporting.rate = 0  (0x0)  (int)
  battery.reporting.current = 3753  (0xea9)  (int)
  battery.charge_level.capacity_state = 'ok'  (string)
  battery.rechargeable.is_discharging = true  (bool)
  battery.rechargeable.is_charging = false  (bool)
  battery.is_rechargeable = true  (bool)
  battery.charge_level.unit = 'mWh'  (string)
  battery.charge_level.granularity_2 = 370000  (0x5a550)  (int)
  battery.charge_level.granularity_1 = 148000  (0x24220)  (int)
  battery.charge_level.low = 1480000  (0x169540)  (int)
  battery.charge_level.warning = 3700000  (0x387520)  (int)
  battery.charge_level.design = 65120000  (0x3e1a700)  (int)
  battery.voltage.design = 14800  (0x39d0)  (int)
  battery.voltage.unit = 'mV'  (string)
  battery.reporting.granularity_2 = 25  (0x19)  (int)
  battery.reporting.granularity_1 = 10  (0xa)  (int)
  battery.reporting.low = 100  (0x64)  (int)
  battery.reporting.warning = 250  (0xfa)  (int)
  battery.reporting.design = 4400  (0x1130)  (int)
  battery.reporting.last_full = 3812  (0xee4)  (int)
  battery.reporting.unit = 'mAh'  (string)
  battery.technology = 'LION'  (string)
  battery.model = '03ZG'  (string)
  battery.vendor = 'SANYO'  (string)
  battery.present = true  (bool)
  info.capabilities = {'battery'} (string list)
  info.category = 'battery'  (string)
  battery.type = 'primary'  (string)
  info.product = 'Battery Bay'  (string)
  info.parent = '/org/freedesktop/Hal/devices/computer'  (string)
  linux.acpi_type = 0  (0x0)  (int)
  linux.acpi_path = '/proc/acpi/battery/BAT1'  (string)

udi = '/org/freedesktop/Hal/devices/acpi_BAT2'
  info.udi = '/org/freedesktop/Hal/devices/acpi_BAT2'  (string)
  linux.hotplug_type = 4  (0x4)  (int)
  battery.present = false  (bool)
  info.capabilities = {'battery'} (string list)
  info.category = 'battery'  (string)
  battery.type = 'primary'  (string)
  info.product = 'Battery Bay'  (string)
  info.parent = '/org/freedesktop/Hal/devices/computer'  (string)
  linux.acpi_type = 0  (0x0)  (int)
  linux.acpi_path = '/proc/acpi/battery/BAT2'  (string)
Comment 4 Stefan Behlert 2006-01-31 12:42:28 UTC
Danny, Holger: Can we fix this for beta4?
Comment 5 Holger Macht 2006-01-31 14:54:26 UTC
There were some fixes within the library for Beta3. I daubt that it will fix that problem but nevertheless it would be good to test again with beta3. Does powersave -b show the same pessimistic results?
Comment 6 Danny Al-Gaaf 2006-02-01 12:02:33 UTC
I'm not sure if there is a way to fix this. The battery report no present rate, in this case HAL need to guess the rate and this is not a 100% correct algorithm. 

Btw. Does your machine send ACPI Battery events? Could you start 'lshal --monitor', remove the AC adapter and wait 20 minutes and attacht the output of lshal --monitor ? 
Comment 7 Robert Bergelin 2006-02-01 13:32:34 UTC
Created attachment 66025 [details]
lshat and powersave -B output

I added som debug prinf to libpower/battery.c (powersave-0.11.6) and it SEEMS some part of the problem on MY laptop (dell inspiron 8200) is that it halfs (2 batt bays, one empty) the remaining time...since the number of "valid_batteries" is 2! Should be 1. Other than that it SEEMS that  the polled value of /proc/acpi/battery/BAT1 is really weird. Plugged in "remaining capacity" is 65120 mWh, AS SOON as it gets unplugged that drops to 14280 mWh. This has nothing to do with powersave though..??
Comment 8 Holger Macht 2006-02-01 13:45:25 UTC
The library implementation got fixed already (bug #145959). If you like you can try the new packages from ftp://ftp.suse.com/pub/people/hmacht/10.1/ , but I would be suprised if this solves your problem.
Comment 9 Danny Al-Gaaf 2006-02-01 15:27:56 UTC
There is no way to fix this problem. You have a broken ACPI-Battery as you can see here:
  battery.reporting.rate = 25502  (0x639e)  (int)
  battery.reporting.current = 14220  (0x378c)  (int)

The battery reports sometimes a much to high current rate, because of this hal can't compute a correct value for time (percentage should work correct):

 ((double) 14220 / (double) 25502) * 60 * 60 = 2007

--> battery.remaining_time = 2007  (0x7d7)

I see currently no way to fix this.
Comment 10 Robert Bergelin 2006-02-03 06:34:57 UTC
ok, I tested Holgers 0.11.8-1 and it solved the "50% charged" problem (with 2 batt bays, one occupied)! The "remaining_time" is as Danny says, a problem with the batt/acpi implementation (thank you Dell...(Sony?)). As far as I am concerned Holgers 0.11.8-1 is a winner! Thanks!! For *me* the *case is closed* (I am not the submitter of the original bug, nor the owner...so.....).