/org/freedesktop/UPower/devices/DisplayDevice is not updated after plugging and unplugging the battery in my laptop. If I boot my laptop without the battery upower -d reports: Device: /org/freedesktop/UPower/devices/line_power_ACAD native-path: ACAD power supply: yes updated: mar 11 nov 2014 09:25:11 CET (6782 seconds ago) has history: no has statistics: no line-power warning-level: none online: yes icon-name: 'ac-adapter-symbolic' Device: /org/freedesktop/UPower/devices/DisplayDevice power supply: no updated: gio 01 gen 1970 01:00:00 CET (1415701093 seconds ago) has history: no has statistics: no unknown warning-level: none icon-name: '' Daemon: daemon-version: 0.99.1 on-battery: no lid-is-closed: no lid-is-present: yes critical-action: HybridSleep ---------------------------------------------------------------- After connecting the battery: Device: /org/freedesktop/UPower/devices/line_power_ACAD native-path: ACAD power supply: yes updated: mar 11 nov 2014 09:25:11 CET (6797 seconds ago) has history: no has statistics: no line-power warning-level: none online: yes icon-name: 'ac-adapter-symbolic' Device: /org/freedesktop/UPower/devices/battery_BAT1 native-path: BAT1 vendor: LENOVO model: PABAS0241231 serial: 41167 power supply: yes updated: mar 11 nov 2014 11:18:28 CET (0 seconds ago) has history: yes has statistics: yes battery present: yes rechargeable: yes state: charging warning-level: none energy: 34,86 Wh energy-empty: 0 Wh energy-full: 40,38 Wh energy-full-design: 40,4 Wh energy-rate: 0 W voltage: 11,875 V percentage: 86% capacity: 99,9505% technology: lithium-ion icon-name: 'battery-full-charging-symbolic' History (charge): 1415701107 86,000 charging 1415701107 0,000 unknown History (rate): 1415701107 0,000 unknown Device: /org/freedesktop/UPower/devices/DisplayDevice power supply: yes updated: gio 01 gen 1970 01:00:00 CET (1415701108 seconds ago) has history: no has statistics: no battery present: yes state: charging warning-level: none energy: 34,86 Wh energy-full: 40,38 Wh energy-rate: 0 W percentage: 86% icon-name: 'battery-full-charging-symbolic' Daemon: daemon-version: 0.99.1 on-battery: no lid-is-closed: no lid-is-present: yes critical-action: HybridSleep ----------------------------------------------------------------- Disconnecting the battery: Device: /org/freedesktop/UPower/devices/line_power_ACAD native-path: ACAD power supply: yes updated: mar 11 nov 2014 09:25:11 CET (6815 seconds ago) has history: no has statistics: no line-power warning-level: none online: yes icon-name: 'ac-adapter-symbolic' Device: /org/freedesktop/UPower/devices/DisplayDevice power supply: yes updated: gio 01 gen 1970 01:00:00 CET (1415701126 seconds ago) has history: no has statistics: no battery present: yes state: charging warning-level: none energy: 34,87 Wh energy-full: 40,38 Wh energy-rate: 0 W percentage: 86% icon-name: 'battery-full-charging-symbolic' Daemon: daemon-version: 0.99.1 on-battery: no lid-is-closed: no lid-is-present: yes critical-action: HybridSleep It seems that DisplayDevice is not updated even if there is not a battery present. acpi_listen reports battery events after connect and disconnect (2 battery events each). Reading some upower bug report I tried to trigger a refresh of the AC with: "qdbus --system org.freedesktop.UPower /org/freedesktop/UPower/devices/line_power_ACAD org.freedesktop.UPower.Device.Refresh". Refreshing the /org/freedesktop/UPower/devices/DisplayDevice does not work. and then upower -d report: Device: /org/freedesktop/UPower/devices/line_power_ACAD native-path: ACAD power supply: yes updated: mar 11 nov 2014 11:26:00 CET (1 seconds ago) has history: no has statistics: no line-power warning-level: none online: yes icon-name: 'ac-adapter-symbolic' Device: /org/freedesktop/UPower/devices/DisplayDevice power supply: yes updated: gio 01 gen 1970 01:00:00 CET (1415701561 seconds ago) has history: no has statistics: no unknown warning-level: none icon-name: 'battery-missing-symbolic' Daemon: daemon-version: 0.99.1 on-battery: no lid-is-closed: no lid-is-present: yes critical-action: HybridSleep And this is correct. This behaviour lead to this bug: https://bugzilla.gnome.org/show_bug.cgi?id=731948 Other events are reported correctly (AC plug and unplug). acpi -ab reports correctly the status with no visible delay. Maybe the problem is that this laptop does not send AC events when battery is unplugged? I don't know what should be the proper behavior..
If the battery is removed from the list, it's probably a simple bug in the creation of the aggregate battery device.
Can you run: killall -9 upowerd ; /usr/libexec/upowerd -v and capture the output when the battery is present and you unplug it? This should help check where the problem is exactly.
Created attachment 109358 [details] output here is the output of "killall -9 upowerd ; /usr/lib/upower/upowerd -v".
Created attachment 109433 [details] [review] daemon: Split out updating on_battery and warning_level So that we can reuse this code.
Created attachment 109434 [details] [review] daemon: Update display device when battery is removed When removing a battery, make sure to go through the batteries, and update the display device status.
Can you please test those 2 patches on top of upower 1.0?
I did not find upower 1.0 so I tested those patches on top of upower git. In the first patch I think you forgot to move gboolean ret; UpDaemonPrivate *priv = daemon->priv; UpDeviceLevel warning_level from up_daemon_device_changed_cb, so i added those lines to up_daemon_update_warning_level in order to compile. And now it works! DisplayDevice is updated and I get "battery-missing-symbolic". Thank you!
Created attachment 109494 [details] [review] daemon: Split out updating on_battery and warning_level So that we can reuse this code.
Thanks for testing! commit 2e87407eb91407e64f3d23de07b9dc91735a6a49 Author: Bastien Nocera <hadess@hadess.net> Date: Fri Nov 14 23:07:25 2014 +0100 daemon: Use new warning update helper function Rather than the copy/paste code in commit: b9bd275890387fb35c185f37ec0ea1f2aa857818 This makes sure that the AC status is updated. https://bugs.freedesktop.org/show_bug.cgi?id=86144 commit 83ebd3eccbff589af0dc6d2f1978338cdfa10833 Author: Bastien Nocera <hadess@hadess.net> Date: Thu Nov 13 19:20:12 2014 +0100 daemon: Update display device when battery is removed When removing a battery, make sure to go through the batteries, and update the display device status. https://bugs.freedesktop.org/show_bug.cgi?id=86144 commit 4fdb9cee21d0d862ed3b551bebb48cf90d645de4 Author: Bastien Nocera <hadess@hadess.net> Date: Thu Nov 13 19:19:30 2014 +0100 daemon: Split out updating on_battery and warning_level So that we can reuse this code. https://bugs.freedesktop.org/show_bug.cgi?id=86144
Created attachment 109661 [details] [review] daemon: remove unused variable An unused variable was left.
(In reply to Peter Wu from comment #10) > Created attachment 109661 [details] [review] [review] > daemon: remove unused variable > > An unused variable was left. Pushed. Please use full commit-id in the commit messages, don't add Signed-off-by, and either file new bugs or reopen the existing ones, if you don't want patches to be lost.
(In reply to Bastien Nocera from comment #11) > Pushed. Please use full commit-id in the commit messages, Thanks, I learned about using the `git describe` output from the git people. A full commit hash is not human readable, and the git describe output contains both the human readable tag (base) and an abbreviated git hash. I do not mind either way, this is my motivation. > don't add Signed-off-by, and either file new bugs or > reopen the existing ones, if you don't want patches to be lost. This was a quick fix, I'll sent others to the devkit-devel list.
(In reply to Peter Wu from comment #12) > (In reply to Bastien Nocera from comment #11) > > Pushed. Please use full commit-id in the commit messages, > > Thanks, I learned about using the `git describe` output from the git people. > A full commit hash is not human readable, and the git describe output > contains both the human readable tag (base) and an abbreviated git hash. I > do not mind either way, this is my motivation. > > > don't add Signed-off-by, and either file new bugs or > > reopen the existing ones, if you don't want patches to be lost. > > This was a quick fix, I'll sent others to the devkit-devel list. Bugzilla is better actually.
(In reply to Bastien Nocera from comment #13) > (In reply to Peter Wu from comment #12) [..] > > This was a quick fix, I'll sent others to the devkit-devel list. > > Bugzilla is better actually. Okay, should I open a single "fix memleaks" bug with all patches attached? The patches are already availble at https://git.lekensteyn.nl/upower/log/?h=memleak-fixes About the S-o-b line, I was under the impression that this was preferred Richard Hughes (UPower maintainer) does this (git log).
(In reply to Peter Wu from comment #14) > (In reply to Bastien Nocera from comment #13) > > (In reply to Peter Wu from comment #12) > [..] > > > This was a quick fix, I'll sent others to the devkit-devel list. > > > > Bugzilla is better actually. > > Okay, should I open a single "fix memleaks" bug with all patches attached? > The patches are already availble at > https://git.lekensteyn.nl/upower/log/?h=memleak-fixes Please. You can use "git-bz" to do that, it makes it easier. > About the S-o-b line, I was under the impression that this was preferred > Richard Hughes (UPower maintainer) does this (git log). Right. I don't, and a lot of other contributors don't, which makes its usage moot.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.