Bug 253453 - with two batteries, remaining time is calculated for the discharging battery only
Summary: with two batteries, remaining time is calculated for the discharging battery ...
Status: RESOLVED FIXED
Alias: None
Product: solid
Classification: Frameworks and Libraries
Component: powermanagement-daemon (show other bugs)
Version: 4.10.0
Platform: Ubuntu Linux
: NOR minor
Target Milestone: ---
Assignee: Dario Freddi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-07 00:28 UTC by Piotr Keplicz
Modified: 2015-01-19 08:02 UTC (History)
21 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.3.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Keplicz 2010-10-07 00:28:02 UTC
Version:           unspecified (using KDE 4.5.1) 
OS:                Linux

On a notebook with two batteries, battery monitor shows remaining time only for the currently discharging battery.

When the secondary battery goes empty, the remaining time suddenly jumps from 1 minute to 1 hour 30 minutes - the remaining time on the primary battery

Reproducible: Always

Steps to Reproduce:
1. With two batteries attached, pull out the AC adapter to start discharging
batteries.

Actual Results:  
Remaining time is calculated only for the currently discharging battery.

Expected Results:  
Battery monitor should report aggregated remaining time for all the batteries attached.
Comment 1 Robert Ryan 2011-02-08 21:51:35 UTC
I'm experiencing this also.
Comment 2 DGardner 2011-07-22 14:29:05 UTC
Me too (KDE 4.6.5, Fedora 15).

I have two batteries, but the remaining time is useless/pointless until the first battery is drained. I think the capacity of both batteries should be summed before calculating the remaining time. There probably isn't much of a case for providing separate times for each, so the UI does not need to change at all, just the calculation.
Comment 3 Thilo-Alexander Ginkel 2011-08-09 20:17:06 UTC
As I am also experiencing this issue (under KDE 4.6.5), so I would like to help getting it resolved. From what I can see, this isn't purely a display issue, but it also interferes with power profile selection and will happily suspend the laptop (if configured in System Settings) if the lower threshold is crossed by a single battery although the other one is still nearly 100% charged.

I'd appreciate any hints in which component to start fixing the issue (hal?).
Comment 4 Hyacinthe Cartiaux 2012-02-01 18:29:09 UTC
I confirm this bug with kde 4.7.4 and 4.8.0.
The battery monitor shows remaining time for the discharging battery only.

I have disabled all actions related to low battery state in the preferences, because it does not take into consideration the total autonomy, but just the autonomy of one battery...

Please, have a look at this issue ;)
Comment 5 Viranch Mehta 2012-06-07 19:32:28 UTC
Reassigning to dataengines, since this is a bug in the backend not in the user interface.
Comment 6 Jan Kundrát 2012-10-01 15:57:29 UTC
As an annoying bonus, the triggers for auto suspend when the battery level goes "critical" are processed even when just one of them qualifies. For example this ThinkPad T420s just suspended despite having 88% charge on the main battery (tp_smapi's BAT0), having emptied the BAT1 in ultrabay.
Comment 7 Denis Koryavov 2012-12-21 18:04:05 UTC
I can confirm, this bug still exists in KDE 4.9.4. I have Lenovo T420s and I can see only one battery. My laptop may work more than 2 hours and battery shows 100% every time, but If I close laptop lid and open it again, I see only 30-40% of charge after that operation.
Comment 8 Hyacinthe Cartiaux 2013-02-09 21:52:20 UTC
I confirm this bug with kde 4.10 and my t420s + ultra bay battery.

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
Comment 9 Eric MSP Veith 2013-03-16 14:02:53 UTC
Is there a recommended way to test one own's build if one wants to try to fix this bug? I.e., I do not want to overwrite my distribution's packages.
Comment 10 Oliver Henshaw 2013-03-16 14:30:10 UTC
(In reply to comment #9)
> Is there a recommended way to test one own's build if one wants to try to
> fix this bug? I.e., I do not want to overwrite my distribution's packages.

Try kdesrc-buid - http://kdesrc-build.kde.org/ - hopefully the instructions there are enough to get you started. Happy hunting!

If you need questions answering, check out #kde-devel (for build problems etc.) or #solid (for specific problems getting to grips with the powermanagement code) on IRC.
Comment 11 Alex Fiestas 2013-07-28 22:08:56 UTC
Kai, this is fixed isn't it?
Comment 12 Kai Uwe Broulik 2013-07-29 13:28:41 UTC
Remaining time handling is untouched. I want to move it to Solid (or whereever) so we can get the exact "Time to empty" for a particular battery, not just the overall value.
Comment 13 Alex Fiestas 2013-07-29 15:47:01 UTC
According to the code, this is fixed:
http://quickgit.kde.org/?p=kde-workspace.git&a=blob&h=a74f820329258f41b61ec17032c88b42f8daad3d&hb=786439a886d9b3748efeca6e8ed8100d3df14d1d&f=powerdevil%2Fdaemon%2Fbackends%2Fupower%2Fpowerdevilupowerbackend.cpp line 448

So going to close this bug as resolved.

Please, if I'm mistaken and you can still reproduce this in KDE 4.10.5 or 4.11 please feel free to reopen the bug!

Thanks for reporting !
Comment 14 ash.summers 2013-12-05 01:34:36 UTC
I am still experiencing this on 4.11.2. I am using a Lenovo T440s and my steps to reproduce are exactly the same as comment 8.
Comment 15 DGardner 2013-12-05 12:17:56 UTC
I am still experiencing this on KDE 4.11.3, the same issue as comment #8 on a ThinkPad T520.

I have to let the machine auto-suspend, remove (or switch off) the secondary battery, even though it has some charge remaining, and the resume the machine again with just the main battery. Either that or plug in the charger, which is the one thing I rarely have to hand when I am running on two batteries.
Comment 16 Kristian Karl 2013-12-21 11:03:23 UTC
I am still experiencing this on 4.11.4.
I am using a Lenovo X240
Comment 17 Emil 2013-12-22 19:41:16 UTC
I do have the same problem with a Lenovo Thinkpad T440s. I also do have a workaround for the suspend loop described in comment 8:
Apparently the first battery is drained until it's at 5% and then the system uses the second battery. Simply setting the critical level to 4% lets me use the second battery.
Comment 18 Kristian Karl 2013-12-27 07:56:06 UTC
The problem still exists on 4.12.0
Comment 19 Eric Floehr 2014-01-02 19:39:44 UTC
I am still experiencing this in KDE 4.11.3 on openSUSE 13.1. Using a Thinkpad T440s.
Comment 20 Kristian Karl 2014-01-14 10:06:33 UTC
The problem still exists on 4.12.1
Comment 21 Rohan Dhruva 2014-01-25 01:32:55 UTC
I still experience this on KDE 4.12.1; laptop is ThinkPad T430s. The suspend loop in comment 8 still exists.
Comment 22 Uhuru 2014-02-26 11:27:07 UTC
I also experience this on KDE 4.12.1 on a ThinkPad X230.
Comment 23 J Brauchle 2014-02-27 09:53:47 UTC
I can also confirm this problem on a Lenovo Thinkpad T440s using KDE 4.11.5.
Please change the bug status as this is clearly NOT fixed!
Comment 24 J Brauchle 2014-02-27 10:49:21 UTC
This bug is soooo stupid really!

Please simply change line 458 from
---------------
            else if (state == 2) //discharging
---------------
to
---------------
            else if ((state == 2) or (state == 4)) //discharging or fully charged
---------------
to consider fully charged batteries as well!
Comment 25 Kai Uwe Broulik 2014-02-27 11:40:22 UTC
Please go ahead and submit a patch to https://git.reviewboard.kde.org/r/ 
The bug tracker is not meant for supplying patches as they might get lost.
Thank you!
Comment 26 J Brauchle 2014-02-28 13:54:44 UTC
Please see https://git.reviewboard.kde.org/r/116481/

There is a fixed package for openSUSE 13.1 and x86_64 available at 
http://download.opensuse.org/repositories/home:/lnt-sysadmin:/branches:/openSUSE:/13.1:/Update/standard/
Comment 27 Florian Lindner 2014-04-21 11:50:30 UTC
I can confirm this bug for KDE 4.13.0 on Arch Linux.

I have two batteries and get warnings about critical battery situation, though it's just on battery below the threshold, the other one still almost full.

Please reopen that bug.
Comment 28 tetzlav 2014-08-11 18:33:10 UTC
+1 with kubuntu 14.04 (kde 4.13.3) on T410s

:-/
Comment 29 tetzlav 2014-08-11 18:57:54 UTC
Why is this patch not upstream? https://git.reviewboard.kde.org/r/116481/diff/#
Comment 30 tetzlav 2014-08-11 21:01:34 UTC
This patch applied at kde-workspace 4.11.10 and IT WORKS perfectly! :)
https://git.reviewboard.kde.org/r/116481/diff/raw/
Comment 31 Yankiel 2014-09-05 02:14:36 UTC
Same problem with Kubuntu 14.04, in Lenovo Thinkpad X240.
Comment 32 Kai Uwe Broulik 2015-01-13 23:28:11 UTC
Apparently this patch never got merged.
Comment 33 Kai Uwe Broulik 2015-01-17 21:24:13 UTC
Git commit 4110b27013d760f56f862d0b7b9f14bf3ac0fc5b by Kai Uwe Broulik.
Committed on 17/01/2015 at 21:22.
Pushed by broulik into branch 'master'.

Calculate remaining battery lifetime considering all installed batteries

This is based on a patch provided by Joschi Brauchle, thanks!
It has been adjusted to PowerDevil 5 but is only used as a fallback now
since we use UPower's display device now if available

REVIEW: 116481
FIXED-IN: 5.3.0

M  +28   -2    daemon/backends/upower/powerdevilupowerbackend.cpp

http://commits.kde.org/powerdevil/4110b27013d760f56f862d0b7b9f14bf3ac0fc5b