Bug 268109 - battery indicator shows zero battery on suspend + resume
Summary: battery indicator shows zero battery on suspend + resume
Status: RESOLVED UPSTREAM
Alias: None
Product: solid
Classification: Frameworks and Libraries
Component: powermanagement (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Dario Freddi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-10 06:24 UTC by Anish Bhatt
Modified: 2011-09-30 11:36 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
battery lever faulty (12.20 KB, image/png)
2011-03-31 21:09 UTC, Lukas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anish Bhatt 2011-03-10 06:24:13 UTC
Version:           unspecified (using KDE 4.6.1) 
OS:                Linux

acpitool -B will show the correct battery status, but the battery monitor applet shows zero battery after resuming. Restarting kdm/laptop fixes it. Can provide more debugging info if someone can guide me.

Reproducible: Sometimes

Steps to Reproduce:
suspend, resume, check battery applet

Actual Results:  
battery applet shows zero battery
Comment 1 Vasyl Demin 2011-03-23 19:44:21 UTC
Same problem here.
Lenovo Thinkpad T510, Arch Linux x86_64, KDE 4.6.1.

Sometimes after resume battery applet shows a very little value (~9%).
acpitool -b shows right value:
Battery #1     : discharging, 86.46%, 01:46:37
Comment 2 Anish Bhatt 2011-03-23 19:46:42 UTC
I have a thinkpad T410, perhaps lenovo specific ? I've also seen it intermittently fix itself after a couple of resumes.
Comment 3 Vasyl Demin 2011-03-24 08:33:26 UTC
> I've also seen it intermittently fix itself after a couple of resumes.
Me too.
Comment 4 Heine Pedersen 2011-03-30 20:39:36 UTC
(In reply to comment #2)
> I have a thinkpad T410, perhaps lenovo specific ? I've also seen it
> intermittently fix itself after a couple of resumes.

I can also confirm this problem with Thinkpad T410.
acpi -b returns: 84%
KDE claims: 10% (charged)

Version: KDE 4.6.1
OS: ArchLinux x86_64
Comment 5 Lukas 2011-03-31 21:09:36 UTC
Created attachment 58480 [details]
battery lever faulty
Comment 6 Lukas 2011-03-31 21:14:37 UTC
I can confirm same bug on ThinkPad T410. 

Always happens after resume from standby. Sometimes it fixes magically, but in most cases, it looks like KDE is trying to manually calculate remaining battery, and then fails.

On the other hand - remaining TIME is displayed quite accurately.
Some times I get e.g. Remaining 7%; 3:15 hours. IT should be more like 70%
Comment 7 Lukas 2011-03-31 21:15:41 UTC
I can confirm same bug on ThinkPad T410. 

Always happens after resume from standby. Sometimes it fixes magically, but in most cases, it looks like KDE is trying to manually calculate remaining battery, and then fails.

On the other hand - remaining TIME is displayed quite accurately.
Some times I get e.g. Remaining 7%; 3:15 hours. IT should be more like 70%.

Cant there be a rounding mistake?
Comment 8 Lukas 2011-03-31 21:21:31 UTC
One more thing - the remaining time in plasmoid and acpi is relatively close, but definitively not the same. Where does KDE read battery info from?

linux-ia7r:/home/lukas # acpi
Battery 0: Discharging, 98%, 02:21:33 remaining

KDE
10% 2:17
Comment 9 Jan Ritzerfeld 2011-04-30 19:00:19 UTC
Same here with a ThinkPad T410s after some suspend/resume cycles. The problem seems to be that /proc/acpi/battery/BAT0/state switches from reporting mWh to mAh! Then, all values are 10x smaller than before and, thus, 10% really means 100%.
Comment 10 Jan Ritzerfeld 2011-04-30 23:24:35 UTC
BTW, /sys/class/power_supply/BAT0/energy_now constantly reports µAh.
Comment 11 Anish Bhatt 2011-05-20 04:16:21 UTC
That might be distro specific. I have current_now & charge_now, no energy_now. In the meantime, could we get the cancel button that was there previously with the 30 seconds warning back. I end up having to run to the power outlet as cancel is no longer an option, even though the battery has charge.
Comment 12 Jan Ritzerfeld 2011-05-20 20:00:47 UTC
@Anish:
You are right. Do these files constantly report µAh for you?

@All:
A much more serious problem arises, if /proc/acpi/battery/BAT0/state switches from reporting mAh to mWh, i.e., the other way round. Then, the applet always thinks that the battery is full, even if it is almost empty. Thus, there is finally no automatic shutdown!
Comment 13 Lukas 2011-05-20 23:17:22 UTC
Well, cant we use data from /sys/class/power_supply/BAT0/, so

REAL_CHARGE  = charge_now/charge_full * 100;

?
From what I have tested, it always showed right values.

If some hardware/distros does not support this, just fall back to the current system.
Comment 14 Vasyl Demin 2011-08-03 18:02:09 UTC
KDE 4.7.0
Problem seems to be fixed for me
Comment 15 Dario Freddi 2011-09-30 11:36:29 UTC
It was mostly like an upstream bug - recent versions of UPower should have fixed that.