Bug 156597

Summary: [PATCH] select active battery, option to ignore nonexsistent battery
Product: [Unmaintained] plasma4 Reporter: Szabolcs Illes <s.illes79>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: wishlist CC: mail, rdieter
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Patch against svn revision 767340
Fix counting of batteries so that the cumulative charge ignores empty batteries

Description Szabolcs Illes 2008-01-24 21:23:50 UTC
Version:            (using KDE 4.0.0)
Installed from:    SuSE RPMs

I have a Dell 8600C. I have two battery slots, but only one battery is installed. The battery applet shows 2 batteries one is always 0%. And this goes into the summary, so my maximum charge is 50%. Or I can have the batteries separately displayed, but in that case the second one is there for nothing since it's always empty

Instead of (or besides) the "show the state of each battery" I'd like two have a list where I can select which battery I want to see and include into the summary. hope ti makes sense :)
Comment 1 Aaron J. Seigo 2008-01-24 21:51:49 UTC

*** This bug has been marked as a duplicate of 155239 ***
Comment 2 Christoph Burger-Scheidlin 2008-01-27 21:43:37 UTC
Created attachment 23314 [details]
Patch against svn revision 767340

This patch adds a configuration option for the battery widget to make it ignore
empty batteries bays.
Comment 3 Christoph Burger-Scheidlin 2008-01-27 21:47:19 UTC
Reopening this. The discussion in bug 155239 has closed without taking into account the option of ignoring missing batteries. bug 156652 resulted but it asks for the selection of an arbitrary battery which is beyond simply omitting the missing batteries. I have also added a patch to add this functionality and hope it can get tested and committed.
Comment 4 Christoph Burger-Scheidlin 2008-01-27 21:54:59 UTC
In fact selecting the battery of interest is not the same as ignoring missing batteries. If a battery is plugged in, this battery would get ignored if it is not selected to start with.
Comment 5 Sebastian Kügler 2008-01-28 09:26:03 UTC
I think a nicer solution would be to ignore empty bays when 'cumulative' mode is used. That saves a config option. Also, I can't think of a usecase where it makes sense to keep an empty bay into account when checking for charge percentage.

I have committed a patch which does that last Saturday, can you check if this behaviour works for you, and re-open + explain why it doesn't if not?
Comment 6 Christoph Burger-Scheidlin 2008-01-28 11:43:22 UTC
The code currently (svn of now, revision 767556) still takes empty bays into account in cumulative mode. In particular I think that the patch from Revision 766341 to 766875 puts an if () in the wrong part of the code (at line 542 instead of 555)
Comment 7 Christoph Burger-Scheidlin 2008-01-28 11:44:27 UTC
Created attachment 23332 [details]
Fix counting of batteries so that the cumulative charge ignores empty batteries
Comment 8 Christoph Burger-Scheidlin 2008-01-28 11:47:44 UTC
I still think that the patch in comment 2 is useful if you want to show battery details, yet only the present batteries are to be shown. Thus if you have 2 batteries and one is missing, only 1 is shown. When you plug in the second one, it gets displayed next to it. (I have not tested hotplugging, and it might need an additional update() call in the dataUpdated() function)
Comment 9 Sebastian Kügler 2008-01-28 17:19:29 UTC
Useful, maybe, but I wonder how common this case actually is. I'd like to avoid cluttering the UI too much, and such a config option comes at a certain cost ....

I've corrected the battery_num counting, thanks for that!
Comment 10 Luka Renko 2008-01-28 20:25:53 UTC
I would agree that adding additional option would be adding lots of complexity (used by limited number of users). I think best would be to just add/remove plugged batteries automatically (always). No battery case would therefore be only used if there is no battery at all.
Comment 11 Luka Renko 2008-01-28 20:26:44 UTC
See also bug 156652