Bug 155239

Summary: battery applet shows empty bay as 0% battery
Product: [Unmaintained] plasma4 Reporter: Laurens Vanhove <laurens>
Component: widget-batteryAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: rdieter, s.illes79
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Laurens Vanhove 2008-01-07 19:23:29 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 4.1.2 
OS:                Linux

I have a Dell Latitude D820, with two battery bays. Only one battery is present.
Solid detects everything :

laurens@latitude ~ $ solidshell hardware list details | grep -i bat
udi = '/org/freedesktop/Hal/devices/acpi_BAT0'
  product = 'Battery Bay'  (string)
  Battery.plugged = true  (bool)
  Battery.type = 'PdaBattery|UpsBattery|PrimaryBattery'  (0x3)  (enum)
  Battery.chargePercent = 100  (0x64)  (int)
  Battery.rechargeable = true  (bool)
  Battery.chargeState = 'NoCharge'  (0x0)  (enum)
udi = '/org/freedesktop/Hal/devices/acpi_BAT1'
  product = 'Battery Bay'  (string)
  Battery.plugged = false  (bool)
  Battery.type = 'PdaBattery|UpsBattery|PrimaryBattery'  (0x3)  (enum)
  Battery.chargePercent = 0  (0x0)  (int)
  Battery.rechargeable = false  (bool)
  Battery.chargeState = 'NoCharge'  (0x0)  (enum)

But the plasma battery applet shows two batteries, the real one, and a second one that is always 0% (but in fact this is just an empty bay, or an unplugged battery as solid calls it). I believe it would be better to hide empty bays.

I've taken a look at the sources, and it seems that the powermanager datasource can handle unplugged batteries, but that the battery applet isn't using this information.

The patch at http://bugs.kde.org/show_bug.cgi?id=153398 may have something to do with this.
Comment 1 Laurens Vanhove 2008-01-07 19:29:15 UTC
Some more details :
I'm using the trunk svn of today (2008/01/07).
The "show the state for each battery present" option is on, when it's off, the applet indicates a 50% charge (which is false, the single battery is full).
Comment 2 Elias Probst 2008-01-18 03:08:56 UTC
I would like to see this changed too.
When removing a battery from a bay, the slot for this battery should be removed from the applet instead of showing a battery at 0%.
Comment 3 Aaron J. Seigo 2008-01-24 21:51:51 UTC
*** Bug 156597 has been marked as a duplicate of this bug. ***
Comment 4 Piotr Pełzowski 2008-01-25 12:52:48 UTC
Maybe there is a possibility of automatic checking if second battery slot is used at all? I have compaq nx6310, adding second battery is optional and most nx6310 users have only one battery. I don't consider buying another one, and as a result if I check "Show the state for each battery present" I will get one useless battery icon. If I don't check this option I have only one icon but state is marked as 50% which is technically correct but it is not correct from user perspective. 

In Bug #156597, someone stated that "I'd like two have a list where I can select which battery I want to see and include into the summary.". It is not the best way to fix this. I could live with this and configure it for me, but much better way of fixing this is to remove useless icon from applet instead of showing a battery at 0%. (as stated in comment #2)
Comment 5 Christian Loose 2008-01-25 15:47:45 UTC
The powermanagement dataengine offers the bool value "Plugged in" for the battery. The applet should only display the battery if this value is true.
Comment 6 Chani 2008-01-25 16:09:35 UTC
Piotr: the computer can't know that you never plan to use that slot.

I agree that having an empty bay bring the total down to 50% is wrong. I'm not sure if I agree with completely hiding empty bays.
I was thinking that I'd want to see whether the laptop was plugged in even if no batteries were in... and then realised just how little sense that makes. :) ok, maybe ignoring empty bays isn't such a bad idea.

I think it would also be nice to have the option to show one specific battery - that would allow you to put your batteries in different places on your desktop if you liked, too. but this would be a separate feature request. :)
Comment 7 Chani 2008-01-25 16:23:29 UTC
there we go. people interested in showing individual batteries can vote for bug 156652
Comment 8 Sebastian Kügler 2008-01-26 21:42:25 UTC
Fixed in SVN commit 766875 by sebas:

Store data from pm-engine in a QHash. We also want to know if 
the battery is plugged in. Also, display "No Battery" if it's
not plugged in -- and if wanted, per bay.
Comment 9 Elias Probst 2008-01-26 23:01:11 UTC
Thanks for the fix!
Will take a look at the result tomorrow.