[gnome-settings-daemon/benzea/remove-suspend-then-hibernate] power: Disable use of suspend-then-hibernate by default



commit 5de02cd0788cc704c01af3a80d5dc4987e86231d
Author: Benjamin Berg <bberg redhat com>
Date:   Thu Oct 4 11:24:08 2018 +0200

    power: Disable use of suspend-then-hibernate by default
    
    Unfortunately this feature is not ready for wider consumption. Also, we
    will need more invasive changes to properly fix this issue, which makes
    it hard to add a runtime option for it in the short term.
    
    For this reason, revert the change again but leave a way to re-enable it
    at build time if it really is desired. See NEWS for more details.

 NEWS                                        | 24 ++++++++++++++++++++++++
 meson.build                                 |  5 +++++
 meson_options.txt                           |  2 ++
 plugins/media-keys/gsd-media-keys-manager.c |  2 ++
 plugins/power/gsd-power-manager.c           |  2 ++
 plugins/power/meson.build                   |  3 ++-
 plugins/power/test.py                       |  6 +++++-
 7 files changed, 42 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 0c7678d1..1d33227b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,27 @@
+==============
+Version 3.30.2
+==============
+
+This release by default *removes* the new feature that was added in 3.29.0 to
+use SuspendAndHibernate when available. You can re-enable the feature using the
+"experimental_suspend_then_hibernate" meson option again.
+
+There are two major issues with the new feature in the current form, and fixing
+it will require more changes that are not feasible in the stable release cycle.
+
+The two main issues are:
+ * Hibernation is often not properly supported. The reasons range from it being
+   simply impossible (secure boot), to driver and firmware issues when resuming
+   and also distribution issues where the system is not correctly set-up and
+   we cannot detect the issue.
+ * It was missed that the support added into g-s-d is incomplete and therefore
+   creates an inconsistent user experience. In particular, we have four major
+   methods to suspend the machine, but only two are affected:
+    - hardware power button: will use suspend-then-hibernate if available
+    - idle suspend: will use suspend-then-hibernate if available
+    - suspend in gnome-shell: always suspends
+    - lid closing: always suspends (systemd)
+
 ================
 Version 3.30.1.1
 ================
diff --git a/meson.build b/meson.build
index b2726f72..fea1cee9 100644
--- a/meson.build
+++ b/meson.build
@@ -117,6 +117,10 @@ libgvc = subproject(
 )
 libgvc_dep = libgvc.get_variable('libgvc_dep')
 
+# Suspend-then-hibernate kill switch
+use_suspend_then_hibernate = get_option('experimental_suspend_then_hibernate')
+config_h.set10('USE_SUSPEND_THEN_HIBERNATE', use_suspend_then_hibernate)
+
 # GUdev integration (default enabled)
 enable_gudev = get_option('gudev')
 if enable_gudev
@@ -239,6 +243,7 @@ output += '        Cups support:             ' + enable_cups.to_string() + '\n'
 output += '        Wayland support:          ' + enable_wayland.to_string() + '\n'
 output += '        Wacom support:            ' + enable_wacom.to_string() + '\n'
 output += '        RFKill support:           ' + enable_rfkill.to_string() + '\n'
+output += '        Suspend-then-hibernate:   ' + use_suspend_then_hibernate.to_string() + '\n'
 if enable_smartcard
   output += '        System nssdb:             ' + system_nssdb_dir + '\n'
 endif
diff --git a/meson_options.txt b/meson_options.txt
index 50bd1749..1e0c5966 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -8,3 +8,5 @@ option('network_manager', type: 'boolean', value: true, description: 'build with
 option('rfkill', type: 'boolean', value: true, description: 'build with rfkill support (not optional on 
Linux platforms)')
 option('smartcard', type: 'boolean', value: true, description: 'build with smartcard support')
 option('wayland', type: 'boolean', value: true, description: 'build with Wayland support')
+
+option('experimental_suspend_then_hibernate', type: 'boolean', value: false, description: 'use 
suspend-then-hibernate if available (NOT recommended)')
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index 36441bf1..b171a3b4 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -2008,6 +2008,7 @@ suspend_action (GsdMediaKeysManager *manager,
         g_autoptr(GVariant) retval = NULL;
         g_autoptr(GError) error = NULL;
 
+#if USE_SUSPEND_THEN_HIBERNATE
         retval = g_dbus_proxy_call_sync (manager->priv->logind_proxy,
                                          "CanSuspendThenHibernate",
                                          NULL,
@@ -2025,6 +2026,7 @@ suspend_action (GsdMediaKeysManager *manager,
                 if (g_strcmp0 (s2h, "yes") == 0)
                         action = "SuspendThenHibernate";
         }
+#endif /* USE_SUSPEND_THEN_HIBERNATE */
         g_debug ("Choosing suspend action: %s", action);
 
         power_action (manager, action, allow_interaction);
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index c4f27592..3078ce4f 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -938,6 +938,7 @@ action_suspend (GsdPowerManager *manager)
                 return;
         }
 
+#if USE_SUSPEND_THEN_HIBERNATE
         retval = g_dbus_proxy_call_sync (manager->priv->logind_proxy,
                                          "CanSuspendThenHibernate",
                                          NULL,
@@ -954,6 +955,7 @@ action_suspend (GsdPowerManager *manager)
                 if (g_strcmp0 (s2h, "yes") == 0)
                         action = "SuspendThenHibernate";
         }
+#endif /* USE_SUSPEND_THEN_HIBERNATE */
         g_debug ("Choosing suspend action: %s", action);
 
         g_dbus_proxy_call (manager->priv->logind_proxy,
diff --git a/plugins/power/meson.build b/plugins/power/meson.build
index 1db2a83a..8e8dcd3a 100644
--- a/plugins/power/meson.build
+++ b/plugins/power/meson.build
@@ -123,7 +123,8 @@ test_py = find_program('test.py')
 envs = [
 #  'G_DEBUG=fatal_warnings',
   'BUILDDIR=' + meson.current_build_dir(),
-  'TOP_BUILDDIR=' + meson.build_root()
+  'TOP_BUILDDIR=' + meson.build_root(),
+  'USE_SUSPEND_THEN_HIBERNATE=' + (use_suspend_then_hibernate ? '1' : '0'),
 ]
 
 test(
diff --git a/plugins/power/test.py b/plugins/power/test.py
index 28addb28..40f9ce1b 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -582,6 +582,7 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
         # And check we're not idle
         self.assertEqual(self.get_status(), gsdpowerenums.GSM_PRESENCE_STATUS_AVAILABLE)
 
+    @unittest.skipIf(os.getenv('USE_SUSPEND_THEN_HIBERNATE') is None, "Please set USE_SUSPEND_THEN_HIBERNATE 
to indicate how g-s-d was compiled")
     def test_sleep_inactive_battery_hibernate_then_suspend(self):
         '''Verify we SuspendThenHibernate on sleep-inactive-battery-timeout when SuspendThenHibernate is 
available'''
         # Hibernate then suspend is the default
@@ -595,7 +596,10 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
 
         # suspend should happen after inactive sleep timeout + 1 s notification
         # delay + 1 s error margin
-        self.check_for_suspend(7, methods=['SuspendThenHibernate'])
+        if os.getenv('USE_SUSPEND_THEN_HIBERNATE') == '1':
+            self.check_for_suspend(7, methods=['SuspendThenHibernate'])
+        else:
+            self.check_for_suspend(7, methods=['Suspend'])
 
     def test_sleep_inactive_battery_no_hibernate_then_suspend(self):
         '''Verify we Suspend on sleep-inactive-battery-timeout when SuspendThenHibernate is unavailable'''


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]