Bug 329537

Summary: Dual batteries are not considered for power management induced suspend/hibernate
Product: [Unmaintained] solid Reporter: Kevin Clevenger <kevin.clevenger>
Component: powermanagement-daemonAssignee: Dario Freddi <drf>
Status: RESOLVED FIXED    
Severity: normal CC: bomba, cfeck, emmanuelpescosta099, kai, P.Rehs, patetvince.achats
Priority: NOR    
Version: 4.11.4   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 4.11.11
Sentry Crash Report:

Description Kevin Clevenger 2014-01-02 18:55:16 UTC
Power management seemingly only checks the charge status of one battery before initiating a suspend or hibernate. This usually occurs when resuming from hibernate, and has happened several times - I resume from suspend with one battery at 0%-5% and the second battery fully charged and the system immediately goes into a charge state induced hibernate.  

Reproducible: Always

Steps to Reproduce:
1. Resume with one battery at 0%-5% charge and another fully charged
2.
3.
Actual Results:  
System immediately goes back into suspend/hibernate.

Expected Results:  
Check the charge status of both batteries before taking any action.

This can be worked around by setting "When battery is at critical level->Do nothing", but it's a non-optimum solution.
Comment 1 Christoph Feck 2014-01-02 22:26:17 UTC

*** This bug has been marked as a duplicate of bug 326491 ***
Comment 2 Kevin Clevenger 2014-01-03 01:46:16 UTC
Yes, I saw the other bug [326491], but it's really not the same issue. My system sees both batteries just fine, the Plasma bar widget displays both, etc. The issue is that the charge state of both is not considered before automatically hibernating.
Comment 3 vincent.mm 2014-01-08 11:02:32 UTC
I can conrim this bug with opensuse 13.1 KDE 4.12 and a viao pro.
Steps to reproduce:
* 2 batteries, 1 fully charged, one at a low level
* when the level of only one battery goes critical, the laptop is suspended
* on wake-up, my laptop is suspended again, and I'm trapped at this step indefinitely, so my second battery is not usable.

This is not a diplicate of  bug 326491 but of Bug 253453 comment 8.
But this latest bug is noticed as closed.
Comment 4 Christoph Feck 2014-05-08 20:36:34 UTC
Okey, but this is a duplicate of bug 325707?
Comment 5 vincent.mm 2014-05-08 20:47:00 UTC
Yes, it seems.
I've upgraded to kde 4.13. Itt is really great, and the bug does not appear any more. Thanks.
Comment 6 vincent.mm 2014-05-11 11:37:52 UTC
I'm sorry, the bug is still there in kde4.13 and opensuse 13.1.
If I start  the computer with one battery very low it shutdowns automatically.
Comment 7 Emmanuel Pescosta 2014-06-17 17:43:14 UTC
Review-Request: https://git.reviewboard.kde.org/r/118801/
Comment 8 Emmanuel Pescosta 2014-06-23 16:47:57 UTC
Git commit 775a99e8bc1e9c5e277ff17a84a406227a5a32fb by Emmanuel Pescosta.
Committed on 17/06/2014 at 15:35.
Pushed by emmanuelp into branch 'KDE/4.11'.

Consider additional batteries for power management (when the critical battery timer is running)

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).

Note: The 30 sec timeout message will still popup.

Tested with a Thinkpad T440s (two batteries)

@Philipp Paris: Thanks for testing!
Related: bug 325707
FIXED-IN: 4.11.11
REVIEW: 118801

M  +13   -1    powerdevil/daemon/powerdevilcore.cpp

http://commits.kde.org/kde-workspace/775a99e8bc1e9c5e277ff17a84a406227a5a32fb
Comment 9 Christoph Feck 2014-07-15 13:56:30 UTC
*** Bug 337414 has been marked as a duplicate of this bug. ***
Comment 10 Christoph Feck 2014-07-23 16:39:37 UTC
*** Bug 337727 has been marked as a duplicate of this bug. ***
Comment 11 Kai Poeritz 2014-07-23 21:38:58 UTC
Sorry opend this bug https://bugs.kde.org/show_bug.cgi?id=337727

Is this prolem fixed yet? I seems to be as if it is still there...
Comment 12 Christoph Feck 2014-07-23 22:33:46 UTC
Please check the "Version Fixed In" field of this page.

It should be fixed if you upgrade KDE Workspace to 4.11.11 (which comes with KDE SC 4.13.3). If not, please add a comment or reopen the bug.
Comment 13 vincent.mm 2014-07-24 06:57:43 UTC
With KDE 4.13.3 it's ok. I have battery to 0 and the other with 15% and it does not shutdown. Thanks
Comment 14 Emmanuel Pescosta 2014-07-29 19:48:26 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 337414, bug 325707

FIXED-IN: 5.1

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

http://commits.kde.org/powerdevil/dc6753889e0428c7e7072d5cb9ea2cd8be4340fa
Comment 15 Philipp Rehs 2015-05-06 17:34:38 UTC
Hello,
i am sorry that i have to reopen this ticket but i am using KDE 5.3 with Powerdevil 5.3.0 on my T440s with Archlinux and i still have this problem.
I receive the 30 second message and some seconds later the systems goes off even if the second battery is full
Comment 16 Christoph Feck 2015-05-06 19:35:03 UTC
Philipp, please report a bug for product "Powerdevil".