After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 709576 - Notifications not showing on critical battery
Notifications not showing on critical battery
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: power
3.8.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2013-10-07 15:10 UTC by William Jon McCann
Modified: 2013-10-30 12:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
power: Fix notification never showing up (2.64 KB, patch)
2013-10-11 16:12 UTC, Bastien Nocera
none Details | Review
power: Fix notification never showing up (2.71 KB, patch)
2013-10-11 17:04 UTC, Bastien Nocera
none Details | Review
power: Add test case for lack of warning on startup (1.58 KB, patch)
2013-10-11 17:04 UTC, Bastien Nocera
none Details | Review
power: Fix notification never showing up (2.81 KB, patch)
2013-10-11 17:20 UTC, Bastien Nocera
committed Details | Review
power: Add test case for lack of warning on startup (1.59 KB, patch)
2013-10-11 17:20 UTC, Bastien Nocera
committed Details | Review
power: Fix notification never showing up (2.30 KB, patch)
2013-10-16 14:35 UTC, Bastien Nocera
none Details | Review

Description William Jon McCann 2013-10-07 15:10:21 UTC
After I updated to 3.10 (F20) my computer no longer handles low battery conditions. I don't get any notifications and the system doesn't try to hibernate. These worked fine in 3.8 (F19).

Also, in the Power settings panel I am unable to click on the "When battery power is critical" option and I'm not sure why.

Perhaps if the system has a battery and hibernate is not available for whatever reason we should explain that to the user.

$ gdbus call  --system --dest org.freedesktop.login1  --object-path /org/freedesktop/login1 --method org.freedesktop.login1.Manager.CanHibernate
('challenge',)
Comment 1 Bastien Nocera 2013-10-07 16:53:11 UTC
(In reply to comment #0)
> After I updated to 3.10 (F20) my computer no longer handles low battery
> conditions. I don't get any notifications and the system doesn't try to
> hibernate. These worked fine in 3.8 (F19).
> 
> Also, in the Power settings panel I am unable to click on the "When battery
> power is critical" option and I'm not sure why.

logind bug:
https://bugs.freedesktop.org/show_bug.cgi?id=70237

> Perhaps if the system has a battery and hibernate is not available for whatever
> reason we should explain that to the user.

We have no way to know why hibernation isn't available, and hibernation is going away as a separate concept on x86 machines.

I filed:
https://bugs.freedesktop.org/show_bug.cgi?id=70244

But this makes for horrible UI, as we don't have an easy way to repair whatever problems there might be (do we launch Disks to try and help the user make a bigger swap?).

> $ gdbus call  --system --dest org.freedesktop.login1  --object-path
> /org/freedesktop/login1 --method org.freedesktop.login1.Manager.CanHibernate
> ('challenge',)

This is what causes hibernation not to be available:
https://bugs.freedesktop.org/show_bug.cgi?id=70237

Let's refocus this bug on the missing notifications.

By default, we would show the critical warning when there's 2 minutes of battery left:
org.gnome.settings-daemon.plugins.power use-time-for-policy
org.gnome.settings-daemon.plugins.power time-critical

Can you capture a gnome-settings-daemon --replace --debug when this happens?

We also have such a case in the test suite as "test_action_critical_battery".
Comment 2 Bastien Nocera 2013-10-11 16:12:25 UTC
Created attachment 257019 [details] [review]
power: Fix notification never showing up

The composite device never sends out a "changed" signal, so
we missed looking at its new warning state to emit critical warnings.
Comment 3 Bastien Nocera 2013-10-11 17:04:36 UTC
Created attachment 257030 [details] [review]
power: Fix notification never showing up

The composite device never sends out a "changed" signal, so
we missed looking at its new warning state to emit critical warnings.
Comment 4 Bastien Nocera 2013-10-11 17:04:47 UTC
Created attachment 257031 [details] [review]
power: Add test case for lack of warning on startup
Comment 5 Bastien Nocera 2013-10-11 17:18:30 UTC
This affected all notifications, but only on startup.

Devices that changed over time weren't affected. And it was broken in 3.8 as well!
Comment 6 Bastien Nocera 2013-10-11 17:20:27 UTC
Created attachment 257034 [details] [review]
power: Fix notification never showing up

Added devices on coldplug were never actually processed, and
the warning level of the composite device was set to its current
value, so that a change never triggered.

This only happened on startup, and affected GNOME 3.8 as well.
Comment 7 Bastien Nocera 2013-10-11 17:20:33 UTC
Created attachment 257035 [details] [review]
power: Add test case for lack of warning on startup
Comment 8 Bastien Nocera 2013-10-11 17:21:20 UTC
Pushed to master for GNOME 3.10.1

Attachment 257034 [details] pushed as dda467f - power: Fix notification never showing up
Attachment 257035 [details] pushed as d04911e - power: Add test case for lack of warning on startup
Comment 9 William Jon McCann 2013-10-11 21:35:54 UTC
Awesome. Thank you!
Comment 10 Rui Matos 2013-10-15 20:28:46 UTC
(In reply to comment #8)
> Pushed to master for GNOME 3.10.1
> 
> Attachment 257034 [details] pushed as dda467f - power: Fix notification never showing up

Should this one be pushed to gnome-3-8 too?
Comment 11 Bastien Nocera 2013-10-16 14:35:16 UTC
Created attachment 257427 [details] [review]
power: Fix notification never showing up

Added devices on coldplug were never actually processed, and
the warning level of the composite device was set to its current
value, so that a change never triggered.

This only happened on startup, and affected GNOME 3.8 as well.

https://bugzilla.gnome.org/show_bug.cgi?id=709576

Conflicts:
	plugins/power/gsd-power-manager.c
Comment 12 Bastien Nocera 2013-10-16 14:35:42 UTC
Reopening for GNOME 3.8. It will need testing.
Comment 13 Bastien Nocera 2013-10-17 09:04:09 UTC
I wonder if this isn't enough:

diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 645df66..d01f116 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -1100,6 +1100,7 @@ engine_coldplug (GsdPowerManager *manager)
 
         for (i=0;i<array->len;i++) {
                 device = g_ptr_array_index (array, i);
+                g_ptr_array_add (manager->priv->devices_array, g_object_ref (device));
                 engine_device_add (manager, device);
                 engine_check_recall (manager, device);
         }
Comment 14 Rui Matos 2013-10-30 10:35:08 UTC
(In reply to comment #13)

This causes g-s-d to export 2 battery devices which gets displayed in gnome-shell as 2 identical batteries.
Comment 15 Rui Matos 2013-10-30 12:28:56 UTC
I just tested this on F19's 3.8.5 g-s-d and I do get low battery notifications. Closing.