Bug 12687 - The battery meter always shows "0%" !
Summary: The battery meter always shows "0%" !
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 4
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: QA Team
QA Contact:
URL:
Whiteboard: MGA4-32-OK MGA4-64-OK advisory
Keywords: validated_update
Depends on:
Blocks:
 
Reported: 2014-02-09 18:33 CET by Maurice Batey
Modified: 2014-05-03 19:36 CEST (History)
8 users (show)

See Also:
Source RPM: upower
CVE:
Status comment:


Attachments

Description Maurice Batey 2014-02-09 18:33:48 CET
Description of problem:

  Battery meter in Panel always shows "0%" (on Toshiba Satellite A120 laptop)

(However the same Mageia release installed on a Samsung NC110 netbook *does* show the correct battery meter reading, as does Mageia-3 on the same laptop.)

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

  N.B. cat /etc/sysconfig/cpupower shows:

          CPUPOWER_START_OPTS="frequency-set -g ondemand
          CPUPOWER_STOP_OPTS="frequency-set -g ondemand

  - and cpupower is running.


How reproducible:

  

Steps to Reproduce:
1. Boot into 32-bit Mageia-4 (KDE) on laptop
2. See that battery meter reports "0%" (with or without charger connected)
3. (See also that the alternative battery meter package    
   ("Pyrtool Battery SystemTray") also reports "0%")


Reproducible: 

Steps to Reproduce:
Maurice Batey 2014-02-09 18:34:03 CET

CC: (none) => maurice

Manuel Hiebel 2014-02-09 19:27:03 CET

CC: (none) => tmb

Comment 1 Sander Lepik 2014-02-09 19:35:55 CET
I think this might be a problem in KDE. I'm having similar problem. Maurice, what happens if you pull the plug for a few minutes - does it start showing correct value?

Keywords: (none) => NEEDINFO
CC: (none) => balcaen.john, lmenut, mageia, mageia

Comment 2 Maurice Batey 2014-02-09 19:52:49 CET
> what happens if you pull the plug for a few minutes - 
> does it start showing correct value?

'fraid not! I had already tried that for a minute or so, and I have now tried pulling the plug before booting Mageia-4, but as soon as was logged in it threatened to close the session because of low battery, so had to re-plug smartly!  (On Mageia-3, the meter showed 99%)

N.B. The netbook has exactly the same KDE Mageia-4 install, but the battery reading is normal...
Comment 3 Nicolas Lécureuil 2014-02-09 19:56:25 CET
what does upower tells about the battery ?
Comment 4 Maurice Batey 2014-02-11 20:43:23 CET
 upower --monitor-detail
Monitoring activity from the power daemon. Press Ctrl+C to cancel.
[19:41:20.168]  device changed:     /org/freedesktop/UPower/devices/battery_BAT1
  native-path:          BAT1
  model:                G71C0001R11E
  serial:               0000000000
  power supply:         yes
  updated:              Tue 11 Feb 2014 19:41:20 GMT (0 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               fully-charged
    energy:              41.013 Wh
    energy-empty:        0 Wh
    energy-full:         41.013 Wh
    energy-full-design:  47.52 Wh
    energy-rate:         0 W
    voltage:             11.38 V
    percentage:          0%
    capacity:            81.9087%
    technology:          lithium-ion
  History (charge):
    1392147597  0.000   unknown
  History (rate):
    1392147597  0.000   unknown
Comment 5 Maurice Batey 2014-02-13 14:34:31 CET
Something inconsistent is going on!

I've just tried booting into Mageia-4 with the charger disconnected (Mageia-3 showing 98%) and the battery meter is correctly reporting that, including (after re-connecting charger) change to "100%".

I had not done a s/w update (but will now do one).

Same if I boot Mageia-4 with charger connected.

Will keep checking...
Comment 6 Sander Lepik 2014-02-13 14:38:57 CET
Then you are seeing the same issue that I'm seeing. When the percentage changes then KDE displays it correctly and after that it's correct on 100% too.
Comment 7 Maurice Batey 2014-02-13 15:19:58 CET
Just done the update (incl. -->3.12.9-desktop-1.mga4) and the battery meter is once again showing "0%"...

  Mmm...
Comment 8 Sander Lepik 2014-02-13 15:26:13 CET
(In reply to Maurice Batey from comment #7)
> Just done the update (incl. -->3.12.9-desktop-1.mga4) and the battery meter
> is once again showing "0%"...
> 
>   Mmm...

As I said, disconnecting will probably bring it back again..
Comment 9 Maurice Batey 2014-02-13 16:50:34 CET
No, whether I boot Mageia-4 with or without the charger connected, it always shows 0%.

(With charger disconnected at bootup I get a "low battery; shutdown in 30 secs"  warning, and if I then re-connect the charger it announces "Charger connected" but still shows "0%"...)

 So at the moment I can't use the laptop unless the charger is connected.
Comment 10 Sander Lepik 2014-02-13 16:57:38 CET
Boot it up, don't log in. Let it run a minute or two. What does it show then? And you should be able to configure KDE to not turn of the system when battery is low. Other DEs probably report the correct charge?
Comment 11 Maurice Batey 2014-02-13 18:51:45 CET
I have always been *booting* Mageia-4 to check this thing, though tried logging out/in as well.

I don't understand your "boot it up, don't log in", though.
  It's the user's battery meter I need to see!

Or do you mean "Do not log in for a few minutes after booting"?
Comment 12 Sander Lepik 2014-02-13 18:53:48 CET
(In reply to Maurice Batey from comment #11)
> Or do you mean "Do not log in for a few minutes after booting"?
Yes, let it run on battery for a few minutes and then log in and connect charger.
Comment 13 Maurice Batey 2014-02-13 19:16:11 CET
OK - tried several combinations:

(1) Charger unplugged, boot, wait 3-4 mins, login: 0%
(2)    "    connected,  "       "           "     99%
(3)    "    unplugged,  "  login immediately:     99%
(4)    "    connected,  "    "      "       :     98%

Make of that what you will! So inconsistent...
Comment 14 Maurice Batey 2014-02-13 19:43:26 CET
Interesting discovery!

If I boot up, wait, login with charger disconnected, Mageia-4 shows "0%" and then puts the laptop to sleep.
   If I then connect the charger and wake the system, it shows "99%"...
Comment 15 Maurice Batey 2014-02-14 12:34:55 CET
Just tried again. This time upower reports an empty battery:

upower --monitor-detail
Monitoring activity from the power daemon. Press Ctrl+C to cancel.
[11:32:51.510]  device changed:     /org/freedesktop/UPower/devices/battery_BAT1
  native-path:          BAT1
  model:                G71C0001R11E
  serial:               0000000000
  power supply:         yes
  updated:              Fri 14 Feb 2014 11:32:51 GMT (0 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               charging
    energy:              40.694 Wh
    energy-empty:        0 Wh
    energy-full:         40.694 Wh
    energy-full-design:  47.52 Wh
    energy-rate:         18.822 W
    voltage:             11.38 V
    percentage:          0%
    capacity:            81.9087%
    technology:          lithium-ion
  History (rate):
    1392377571  18.822  charging
    1392377555  19.448  charging
    1392377539  19.186  charging
    1392377523  20.108  charging
    1392377507  20.097  charging
    1392377491  19.801  charging
    1392377475  20.074  charging
    1392377459  20.267  charging

^C
[mab@laptop ~]$ upower --monitor-detail | grep %
    percentage:          0%
    capacity:            81.9087%
    percentage:          0%
    capacity:            81.9087%
    percentage:          0%
    capacity:            81.9087%
^C
Comment 16 Nicolas Lécureuil 2014-02-14 14:18:14 CET
thanks, this prove this is not a KDE issue \o/
Comment 17 Sander Lepik 2014-02-14 20:29:31 CET
Thanks Nicolas for proving me wrong! :) That made me google a bit more and I think I found the problem. At least for my own problem. I hope Maurice has the same issue. It seems to be upower: https://bugs.launchpad.net/bugs/1240673

Maurice, I submitted upower into core/updates_testing - can you please install (will take some time until it reaches mirrors) it and see if it fixes your problem too. Else I have to make a new bug to let QA test that update as it fixes my problem and fixes it probably for many other users too.

Hardware: i586 => All
Source RPM: kernel-3.12.8-2.mga4.src.rpm => upower

Comment 18 Maurice Batey 2014-02-14 21:04:35 CET
Sander said:

> I submitted upower into core/updates_testing - can you please install (will 
> take some time until it reaches mirrors) it and see if it fixes your problem 

  Will do, as soon as I know it is there!

(How shall I know? Is there a command for installing just one particular package from that repository?  [I'm not used to doing that...] )
Comment 19 Sander Lepik 2014-02-14 21:15:14 CET
If you are running i586 then these commands (as root) should help you:
urpmi.update Core\ Updates\ Testing
urpmi upower libupower-glib1 --media Core\ Updates\ Testing

For x86_64 it's "urpmi upower lib64upower-glib1 --media Core\ Updates\ Testing"

If urpmi complains about other upower related packages then install those too.
Comment 20 Maurice Batey 2014-02-15 13:20:08 CET
Did:

   urpmi.update Core\ Updates\ Testing
   urpmi upower libupower-glib1 --media Core\ Updates\ Testing

- rebooted, and (32-bit,KDE) Mageia-4 now correctly reports "100%".

So, the fix worked!
Well done, Sander!

Regards,
/\/\aurice
Comment 21 Sander Lepik 2014-02-15 17:17:03 CET
So it's time to pass it to the QA.

Tests for the fix are actually done. I tested it on x86_64 and the reporter tested it on i586. So the QA should mostly test it for regressions as it's probably not that easy to reproduce (one would need a battery that reports charge over 100%).

So to test, just install the update and see that upower is still reporting ( upower -d|grep percentage) correct charge for your battery.

Suggested advisory:
========================

Some batteries report energy > energy_full and a percentage ("capacity" attribute) > 100%. This update clamps these within 0 and 100% for both plausibility and avoids setting an out-of-range property which would then become 0%.

References:
https://bugs.mageia.org/show_bug.cgi?id=12687
https://bugs.launchpad.net/bugs/1240673
========================

Updated packages in core/updates_testing:
========================
lib(64)upower-glib1-0.9.23-1.1.mga4
lib(64)upower-gir1.0-0.9.23-1.1.mga4
lib(64)upower-glib-devel-0.9.23-1.1.mga4
upower-0.9.23-1.1.mga4

Source RPMs: 
upower-0.9.23-1.1.mga4.src.rpm

This is one of those updates that should end up on new ISOs as w/o fix it might be impossible for new user to even install update if the system wants to turn off computer before you see any available updates.

Keywords: NEEDINFO => (none)
Assignee: bugsquad => qa-bugs

Comment 22 Thomas Backlund 2014-02-17 01:03:56 CET
Tested on both i586 and x86_64 and it works. and going by the code in the patch I dont see how it could cause any breakage.

So validating and advisory uploaded

Keywords: (none) => validated_update
Whiteboard: (none) => MGA4-32-OK MGA4-64-OK advisory
CC: (none) => sysadmin-bugs

Comment 23 Thomas Backlund 2014-02-17 01:36:19 CET
Update pushed:
http://advisories.mageia.org/MGAA-2014-0052.html

Status: NEW => RESOLVED
Resolution: (none) => FIXED

Comment 24 Malo Deniélou 2014-02-17 01:44:52 CET
> I dont see how it could cause any breakage

Famous last words ...

CC: (none) => pierre-malo.denielou

Comment 25 Maurice Batey 2014-05-03 19:36:43 CEST
Well, that did fix the Mageia-4 problem, but now - on a fully-updated 32-bit Mageia-3 on my laptop, the battery indicator has regressed to show 0% when it is actually 100% (just as Mageia-4 was doing before fixed).

upower --monitor-detail
Monitoring activity from the power daemon. Press Ctrl+C to cancel.
[18:32:59.199]  device changed:     /org/freedesktop/UPower/devices/battery_BAT1
  native-path:          /sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/power_supply/BAT1
  model:                G71C0001R11E
  serial:               0000000000
  power supply:         yes
  updated:              Sat May  3 18:32:59 2014 (0 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               fully-charged
    energy:              41.013 Wh
    energy-empty:        0 Wh
    energy-full:         41.013 Wh
    energy-full-design:  47.52 Wh
    energy-rate:         28.108 W
    voltage:             11.38 V
    percentage:          0%
    capacity:            81.9087%
    technology:          lithium-ion

Also, if I disconnect the charger, then the system warns of shutdown, presumably meaning that the system regards that "0%" as correct!
  Is there a fix for Mageia-3, please?

Note You need to log in before you can comment on or make changes to this bug.