Bug 837345

Summary: Battery plasmoid doesn't show correct charge
Product: [Fedora] Fedora Reporter: Andreas Petzold <andreas.petzold>
Component: kde-workspaceAssignee: Lukáš Tinkl <ltinkl>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: chgonzalezg, jgrulich, jreznik, kevin, ltinkl, rdieter, rnovacek, than
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: kde-workspace-4.8.95-3 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-09 14:54:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 831627    
Attachments:
Description Flags
upower dump
none
solid battery details none

Description Andreas Petzold 2012-07-03 14:36:37 UTC
Description of problem:

On my Dell E6320 with kde-workspace-4.8.95-1.fc17.x86_64, the battery plasmoid doesn't show the correct charge value of the battery. The plasmoid changes if the AC adapter i splgged in but still doesn't update the charge value.

Version-Release number of selected component (if applicable):

kde-workspace-4.8.95-1.fc17.x86_64

How reproducible:

Always

Steps to Reproduce:
1.Add battery plasmoid to panel
2.Unplug AC adapter and wait some time
3.compare charge value shown by plasmoid and gkrellm or calculate current charge from values in /sys
  
Actual results:
Plasmoid charge value isn't correct

Expected results:
Plasmoid shows correct charge value of battery.

Additional info:

Comment 1 Lukáš Tinkl 2012-07-03 14:54:13 UTC
$ upower --dump 

and 

$ solid-hardware details /org/freedesktop/UPower/devices/battery_BAT0

Comment 2 Christian Gonzalez 2012-07-03 15:02:05 UTC
Same here (Fedora 17 + kde-workspace-4.8.95-1.fc17.x86_64). Oddly enough, if I run the plasmoid in its own window ("plasma-windowed battery"), it shows the correct charge value of the battery.

More info:

[christian@laptop ~]$ upower --dump 
Device: /org/freedesktop/UPower/devices/line_power_ADP1
  native-path:          /sys/devices/LNXSYSTM:00/device:00/ACPI0003:00/power_supply/ADP1
  power supply:         yes
  updated:              Tue Jul  3 10:40:49 2012 (1174 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    online:             yes

Device: /org/freedesktop/UPower/devices/battery_BAT1
  native-path:          /sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/PNP0C09:00/PNP0C0A:00/power_supply/BAT1
  vendor:               SAMSUNG Electronics
  power supply:         yes
  updated:              Tue Jul  3 10:40:54 2012 (1169 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               fully-charged
    energy:              27.75 Wh
    energy-empty:        0 Wh
    energy-full:         27.75 Wh
    energy-full-design:  44.4 Wh
    energy-rate:         15.1071 W
    voltage:             12.301 V
    percentage:          100%
    capacity:            62.5%
    technology:          lithium-ion

Daemon:
  daemon-version:  0.9.17
  can-suspend:     yes
  can-hibernate    yes
  on-battery:      no
  on-low-battery:  no
  lid-is-closed:   no
  lid-is-present:  yes
  is-docked:       no


[christian@laptop ~]$ solid-hardware details /org/freedesktop/UPower/devices/battery_BAT0
udi = '/org/freedesktop/UPower/devices/battery_BAT0'
  parent = ''  (string)
  vendor = ''  (string)
  product = ''  (string)
  description = ''  (string)


[christian@laptop ~]$ solid-hardware details /org/freedesktop/UPower/devices/battery_BAT1
udi = '/org/freedesktop/UPower/devices/battery_BAT1'
  parent = '/org/freedesktop/UPower'  (string)
  vendor = 'SAMSUNG Electronics'  (string)
  product = 'Lithium Ion Battery'  (string)
  description = 'Lithium Ion Battery'  (string)
  Battery.plugged = true  (bool)
  Battery.type = 'PrimaryBattery'  (0x3)  (enum)
  Battery.chargePercent = 100  (0x64)  (int)
  Battery.rechargeable = true  (bool)
  Battery.chargeState = 'NoCharge'  (0x0)  (enum)

Comment 3 Lukáš Tinkl 2012-07-03 15:33:37 UTC
Christian, can you do the same "dump" when running on battery please?

Comment 4 Christian Gonzalez 2012-07-03 15:38:00 UTC
Sure, here is it:

[christian@laptop ~]$ upower --dump 
Device: /org/freedesktop/UPower/devices/line_power_ADP1
  native-path:          /sys/devices/LNXSYSTM:00/device:00/ACPI0003:00/power_supply/ADP1
  power supply:         yes
  updated:              Tue Jul  3 11:34:10 2012 (137 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    online:             no

Device: /org/freedesktop/UPower/devices/battery_BAT1
  native-path:          /sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/PNP0C09:00/PNP0C0A:00/power_supply/BAT1
  vendor:               SAMSUNG Electronics
  power supply:         yes
  updated:              Tue Jul  3 11:36:10 2012 (17 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    energy:              26.64 Wh
    energy-empty:        0 Wh
    energy-full:         27.75 Wh
    energy-full-design:  44.4 Wh
    energy-rate:         19.314 W
    voltage:             11.912 V
    time to empty:       1.4 hours
    percentage:          96%
    capacity:            62.5%
    technology:          lithium-ion
  History (charge):
    1341329770  96.000  discharging
    1341329720  97.000  discharging
  History (rate):
    1341329770  19.314  discharging
    1341329750  22.233  discharging
    1341329720  19.625  discharging
    1341329695  21.900  discharging

Daemon:
  daemon-version:  0.9.17
  can-suspend:     yes
  can-hibernate    yes
  on-battery:      yes
  on-low-battery:  no
  lid-is-closed:   no
  lid-is-present:  yes
  is-docked:       no

Comment 5 Rex Dieter 2012-07-03 15:53:42 UTC
so, I think there is a correlation between some plasmoids not updating, but only after a suspend->resume cycle.  I'm seeing some oddness with plasma-nm too recently (the applet displays incorrect signal strength).

Any of you seeing this on a fresh boot without ever having suspended?

Comment 6 Lukáš Tinkl 2012-07-03 16:07:54 UTC
$ solid-hardware details /org/freedesktop/UPower/devices/battery_BAT1

too please :)

Comment 7 Christian Gonzalez 2012-07-03 16:16:49 UTC
[christian@laptop ~]$ solid-hardware details /org/freedesktop/UPower/devices/battery_BAT1
udi = '/org/freedesktop/UPower/devices/battery_BAT1'
  parent = '/org/freedesktop/UPower'  (string)
  vendor = 'SAMSUNG Electronics'  (string)
  product = 'Lithium Ion Battery'  (string)
  description = 'Lithium Ion Battery'  (string)
  Battery.plugged = true  (bool)
  Battery.type = 'PrimaryBattery'  (0x3)  (enum)
  Battery.chargePercent = 91  (0x5b)  (int)
  Battery.rechargeable = true  (bool)
  Battery.chargeState = 'Discharging'  (0x2)  (enum)

Comment 8 Christian Gonzalez 2012-07-03 16:19:36 UTC
Rex, you are right. The problem is triggered by a suspend->resume cycle. After a reboot, the battery plasmoid is working as expected.

BTW, I've seen the plasma-nm bug as well. Is there another bug report for this?

Comment 9 Rex Dieter 2012-07-03 16:20:39 UTC
For me, battery applet is stuck at 94% , but


$ upower -d
Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path:          /sys/devices/LNXSYSTM:00/device:00/ACPI0003:00/power_supply/AC
  power supply:         yes
  updated:              Mon Jul  2 16:00:50 2012 (69692 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    online:             yes

Device: /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          /sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/power_supply/BAT0
  vendor:               SMP
  model:                DELL PD6858
  serial:               297
  power supply:         yes
  updated:              Mon Jul  2 16:00:57 2012 (69685 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               fully-charged
    energy:              86.58 Wh
    energy-empty:        0 Wh
    energy-full:         86.58 Wh
    energy-full-design:  86.58 Wh
    energy-rate:         0.0111 W
    voltage:             12.448 V
    percentage:          100%
    capacity:            97.2051%
    technology:          lithium-ion

Daemon:
  daemon-version:  0.9.17
  can-suspend:     yes
  can-hibernate    yes
  on-battery:      no
  on-low-battery:  no
  lid-is-closed:   no
  lid-is-present:  yes
  is-docked:       no



$ solid-hardware details /org/freedesktop/UPower/devices/battery_BAT0
udi = '/org/freedesktop/UPower/devices/battery_BAT0'
  parent = '/org/freedesktop/UPower'  (string)
  vendor = 'SMP'  (string)
  product = 'DELL PD6858'  (string)
  description = 'Lithium Ion Battery'  (string)
  Battery.plugged = true  (bool)
  Battery.type = 'PrimaryBattery'  (0x3)  (enum)
  Battery.chargePercent = 100  (0x64)  (int)
  Battery.rechargeable = true  (bool)
  Battery.chargeState = 'NoCharge'  (0x0)  (enum)



So, seems upower/solid are correct, the applet just isn't getting the update.

Comment 10 Rex Dieter 2012-07-03 16:23:35 UTC
Ah, found https://bugs.kde.org/show_bug.cgi?id=287952  
for this particular issue.

Comment 11 Lukáš Tinkl 2012-07-03 16:47:58 UTC
Yup, looks like it :/ The problem with suspend is that the devices "vanish" from the system (get removed internally) and they reappear upon the resume and the Plasma dataengine holds reference to the stale objects, therefore not receiving any updates.

Comment 12 Andreas Petzold 2012-07-03 17:00:58 UTC
Created attachment 596049 [details]
upower dump

Comment 13 Andreas Petzold 2012-07-03 17:02:06 UTC
Created attachment 596050 [details]
solid battery details

Comment 14 Lukáš Tinkl 2012-07-04 12:30:52 UTC
Just to be sure, is it just the charge percent that isn't getting updated? What about the AC plug state, does the plasmoid correctly react to plugging/unplugging the cable?

Comment 15 Andreas Petzold 2012-07-04 13:53:53 UTC
For me, the AC plug state gets displayed just fine. It's only the charge value that is wrong.

Comment 16 Lukáš Tinkl 2012-07-09 08:56:46 UTC
It looks like this is more related to KDE bug #287952

Comment 17 Lukáš Tinkl 2012-07-09 12:13:25 UTC
The bug is in the battery applet (QML) itself, the powermanagement engine itself is correctly updating the battery charge percent and state, even after suspend/resume.

Comment 18 Rex Dieter 2012-07-09 14:54:33 UTC
%changelog
* Mon Jul 09 2012 Rex Dieter <rdieter> 4.8.95-3
- Battery Monitor widget stops tracking charging state changes after suspend/resume cycle (#837345, kde#287952)