Bug 337414 - Energymanager failed with 2 batteries
Summary: Energymanager failed with 2 batteries
Alias: None
Product: solid
Classification: Frameworks and Libraries
Component: powermanagement (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR grave
Target Milestone: ---
Assignee: Dario Freddi
Depends on:
Reported: 2014-07-13 08:36 UTC by Marc Schulte
Modified: 2014-07-29 19:48 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.1


Note You need to log in before you can comment on or make changes to this bug.
Description Marc Schulte 2014-07-13 08:36:20 UTC
I hope this is the right section, i dont find another section thats fits. 

I have a Lenovo T520 (Archlinux, testing) with 2 9 Cell Batteries. 

If i boot with boths battery full, i can work till booth batteries are empty.

If i use the s2d or s2r while one battery is full and one battery is empty, there are no problems. 

if i use the s2d or s2r while one battery is empty and one battery is half full, i have problems. On every boot, remaining from s2d/s2r, the KDE Power-Managment said my batteries are empty and it will shutdown. 

although still a battery is half full and I could so at least 4 hours work.

I hope you understand my problem (and me ;))

Reproducible: Always

Steps to Reproduce:
1. use 2 Batteries
2. one Batterie empty, one Batterie full
3. restart / use s2r/s2d
Actual Results:  
My laptop will shutdown

Expected Results:  
my laptop will work on "an half full batterie"
Comment 1 Christoph Feck 2014-07-15 13:56:30 UTC

*** This bug has been marked as a duplicate of bug 329537 ***
Comment 2 Emmanuel Pescosta 2014-07-15 17:53:51 UTC
(In reply to Christoph Feck from comment #1)
> *** This bug has been marked as a duplicate of bug 329537 ***

This isn't correct, because powerdevil 5 isn't patched yet (review is pending: https://git.reviewboard.kde.org/r/119087/)
Comment 3 Christoph Feck 2014-07-15 18:22:02 UTC
Next time please reopened the other bug instead. We do not want separate tickets for the same bug in different branches.
Comment 4 Emmanuel Pescosta 2014-07-29 19:48:25 UTC
Git commit dc6753889e0428c7e7072d5cb9ea2cd8be4340fa by Emmanuel Pescosta.
Committed on 29/07/2014 at 19:48.
Pushed by emmanuelp into branch 'master'.

After resuming from suspend, all batteries are added to
powerdevil. When a battery, with charge lower or equal than the critical
charge percentage is added, the critical battery timer will be started.

In the current version the critical battery timeout can
only be interrupted by plugging in AC.

But if the system has more than one battery, the global
charge percentage can be greater than the critical charge
percentage and so the system shouldn't suspend. To achive
this behaviour, we calculate the global charge percentage
whenever a new battery was added and if the critical
battery timer is running and the global charge is high
enough, we stop the timer.

Also we use the already calculated global charge percentage
for the battery charge percentage notification instead of
the charge of each individual battery.

With this patch, the user can not only interrupt the critical
timer by plugging in the AC but also by plugging in a new or
additional battery (if the battery has enough charge).
Related: bug 325707, bug 329537


M  +24   -11   daemon/powerdevilcore.cpp
M  +6    -0    daemon/powerdevilcore.h