Boot with the laptop (Dell Inspiron M4300) running on ac power, and log in to KDE. The battery shows zero charge in the Battery Monitor in the system tray. Pulling out the dc jack plug to run on internal battery the level recovers to correct within a couple of seconds. Plugging in the dc jack again then shows the correct battery level and that it is connected to ac power. This occurs with two different kernels - 3.11.6-1 and also 3.12.0-rc6 Reproducible: Always Steps to Reproduce: 1. Plug in laptop to ac power, boot and login to kde 2. 3. Actual Results: Battery monitor shows zero level incorrectly. Expected Results: Battery monitor should show correct level Pulling out power cable allows correct battery level within a second or two. Plugging power back in then still shows correct battery level. So battery level is only incorrect on boot with the power plugged in. I will attach screenshots showing the incorrect zero level as well as after recovery once the power cable has been pulled out and plugged back in.
Created attachment 82972 [details] Battery indication wrong after boot and login with power cable attached Screenshot shortly after boot and login
Created attachment 82973 [details] After unplugging and replugging power cable battery level is correct Screenshot showing battery level correct by unplugging and replugging power cable
In the screenshots attached to this report also displayed is the battery level from /sys/class/power_supply/BAT0/charge_now, which shows that despite the battery showing zero in the monitor widget the system is seeing a correct value.
Created attachment 82974 [details] .xsession-errors
I have just come across this Ubuntu report https://bugs.launchpad.net/ubuntu/+source/upower/+bug/1240673 So now I am confused as to whether this is a upower or kde bug?
The output from upower -d just before and after the unplug/replug of the power cable are: Prior to unplugging power cable: $ upower -d Device: /org/freedesktop/UPower/devices/line_power_AC native-path: AC power supply: yes updated: Sun 20 Oct 2013 17:53:30 BST (39 seconds ago) has history: no has statistics: no line-power online: yes Device: /org/freedesktop/UPower/devices/battery_BAT0 native-path: BAT0 vendor: SMP model: DELL XD7368 serial: 3261 power supply: yes updated: Sun 20 Oct 2013 17:53:35 BST (34 seconds ago) has history: yes has statistics: yes battery present: yes rechargeable: yes state: fully-charged energy: 57.72 Wh energy-empty: 0 Wh energy-full: 57.72 Wh energy-full-design: 57.72 Wh energy-rate: 0.0111 W voltage: 12.644 V percentage: 0% capacity: 92.4615% technology: lithium-ion History (charge): 1382288010 0.000 unknown History (rate): 1382288011 0.011 fully-charged 1382288010 0.000 unknown Daemon: daemon-version: 0.9.22 on-battery: no on-low-battery: no lid-is-closed: no lid-is-present: yes is-docked: no Then monitoring upower --monitor when the cable is unplugged and replugged: upower --monitor Monitoring activity from the power daemon. Press Ctrl+C to cancel. [17:56:18.973] device changed: /org/freedesktop/UPower/devices/battery_BAT0 [17:56:18.973] device changed: /org/freedesktop/UPower/devices/line_power_AC [17:56:19.861] device changed: /org/freedesktop/UPower/devices/battery_BAT0 [17:56:20.874] device changed: /org/freedesktop/UPower/devices/battery_BAT0 [17:56:21.132] device changed: /org/freedesktop/UPower/devices/battery_BAT0 [17:56:21.863] device changed: /org/freedesktop/UPower/devices/battery_BAT0 [17:56:22.872] daemon changed: [17:56:22.872] device changed: /org/freedesktop/UPower/devices/battery_BAT0 [17:56:23.863] device changed: /org/freedesktop/UPower/devices/battery_BAT0 [17:56:30.179] daemon changed: [17:56:30.179] device changed: /org/freedesktop/UPower/devices/battery_BAT0 [17:56:30.179] device changed: /org/freedesktop/UPower/devices/line_power_AC [17:56:30.851] device changed: /org/freedesktop/UPower/devices/battery_BAT0 [17:56:31.865] device changed: /org/freedesktop/UPower/devices/battery_BAT0 [17:56:32.860] device changed: /org/freedesktop/UPower/devices/battery_BAT0 [17:56:33.868] device changed: /org/freedesktop/UPower/devices/battery_BAT0 [17:56:34.859] device changed: /org/freedesktop/UPower/devices/battery_BAT0 [17:56:35.865] device changed: /org/freedesktop/UPower/devices/battery_BAT0 ^C [root@lapmike3 ~]# upower -d Device: /org/freedesktop/UPower/devices/line_power_AC native-path: AC power supply: yes updated: Sun 20 Oct 2013 17:56:30 BST (21 seconds ago) has history: no has statistics: no line-power online: yes Device: /org/freedesktop/UPower/devices/battery_BAT0 native-path: BAT0 vendor: SMP model: DELL XD7368 serial: 3261 power supply: yes updated: Sun 20 Oct 2013 17:56:35 BST (16 seconds ago) has history: yes has statistics: yes battery present: yes rechargeable: yes state: fully-charged energy: 52.1367 Wh energy-empty: 0 Wh energy-full: 57.72 Wh energy-full-design: 57.72 Wh energy-rate: 24.2202 W voltage: 11.959 V percentage: 97% capacity: 92.4615% technology: lithium-ion History (charge): 1382288182 97.000 discharging 1382288116 0.000 unknown History (rate): 1382288192 24.220 fully-charged 1382288191 36.886 fully-charged 1382288182 24.220 discharging 1382288116 0.011 fully-charged 1382288116 0.000 unknown Daemon: daemon-version: 0.9.22 on-battery: no on-low-battery: no lid-is-closed: no lid-is-present: yes is-docked: no
In my systemd journal these may indicate where the problem lies but is the origin in the upower package or kernel: Oct 20 17:55:16 lapmike3 upowerd[818]: (upowerd:818): UPower-Linux-WARNING **: energy 57.720000 bigger than full 53.368800 Oct 20 17:55:16 lapmike3 upowerd[818]: (upowerd:818): GLib-GObject-WARNING **: value "108.000000" of type 'gdouble' is invalid or out Oct 20 17:55:16 lapmike3 upowerd[818]: (upowerd:818): GLib-GObject-WARNING **: value "108.000000" of type 'gdouble' is invalid or out Oct 20 17:55:16 lapmike3 systemd[1]: Started Daemon for power management. Oct 20 17:55:16 lapmike3 upowerd[818]: (upowerd:818): GLib-GObject-WARNING **: value "108.000000" of type 'gdouble' is invalid or out Oct 20 17:55:17 lapmike3 upowerd[818]: (upowerd:818): GLib-GObject-WARNING **: value "108.000000" of type 'gdouble' is invalid or out Oct 20 17:55:18 lapmike3 upowerd[818]: (upowerd:818): GLib-GObject-WARNING **: value "108.000000" of type 'gdouble' is invalid or out Oct 20 17:55:19 lapmike3 upowerd[818]: (upowerd:818): GLib-GObject-WARNING **: value "108.000000" of type 'gdouble' is invalid or out Oct 20 17:55:20 lapmike3 upowerd[818]: (upowerd:818): GLib-GObject-WARNING **: value "108.000000" of type 'gdouble'
Further comparison between acpi, upower and /sys/proc/xx output before and after the power cable has been replugged indicates that there is a bug in the upower package. The key output is as follows: Immediately after boot the result of the commands are as follows: [mike@lapmike3 ~]$ acpi -b Battery 0: Full, 100% [mike@lapmike3 ~]$ upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage percentage: 0% [mike@lapmike3 ~]$ cat /sys/class/power_supply/BAT0/charge_* 4808000 5200000 5200000 and after unplugging and replugging the power cable the same commands give: [mike@lapmike3 ~]$ acpi -b Battery 0: Full, 100% [mike@lapmike3 ~]$ upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage percentage: 95% [mike@lapmike3 ~]$ cat /sys/class/power_supply/BAT0/charge_* 4808000 5200000 5200000 So it is upower that is incorrectly reporting the battery percentage immediately after boot and presumably that is the parameter that the KDE widget is using. I will test once I have access to the new version of upower 0.9.23 and if the problem remains will then report upstream.
Thanks very much for triaging it down. As I can see on your upower -d output this is an upstream upower issue since we just use the value upower provides. And if upower says the battery is empty, we can't tell if it's not. Please go ahead and file a bug against upower and/or test with a newer version if available. :-)
OK Kai, I will test as soon as the newer upower package becomes available in archlinux, and then will report back here. If upower 0.9.23 does not provide a fix then I will report upstream and add a comment to this thread.
This evening the problem is resolved after the following archlinux packages were updated: ( 1/15) upgrading curl [##############################################] 100% ( 2/15) upgrading dialog [##############################################] 100% ( 3/15) upgrading faad2 [##############################################] 100% ( 4/15) upgrading jasper [##############################################] 100% ( 5/15) upgrading lcms2 [##############################################] 100% ( 6/15) upgrading libarchive [##############################################] 100% ( 7/15) upgrading libmad [##############################################] 100% ( 8/15) upgrading libmng [##############################################] 100% ( 9/15) upgrading lua51-socket [##############################################] 100% (10/15) upgrading qt4 [##############################################] 100% (11/15) upgrading shadow [##############################################] 100% (12/15) upgrading util-linux [##############################################] 100% New optional dependencies for util-linux python: python bindings to libmount [installed] (13/15) upgrading systemd [##############################################] 100% (14/15) upgrading sysvinit-tools [##############################################] 100% (15/15) upgrading systemd-sysvcompat [##############################################] 100% The battery indication in the KDE widget is now working perfectly normally, even though upower was not among the updates! Hence this is resolved but not for the reason I expected! I don't know which of the packages in the list above made the fix but all is well (this was confirmed on a second and different laptop which was exhibiting the same issue - a Dell D610).
It turned out that there was still a battery indication problem due to a bug in upower in the situation where the battery was "over"full. This is now resolved fully in the archlinux package version upower 0.9.23-2. The upstream report where this was discussed is at https://bugs.freedesktop.org/show_bug.cgi?id=70952