Blame SOURCES/0001-power-Only-disable-Suspend-Hibernate-actions-inside-.patch

1f4aa6
From e1ccd6042815f7fa7c9a30fe8569cd612bdabc0d Mon Sep 17 00:00:00 2001
1f4aa6
From: Benjamin Berg <bberg@redhat.com>
1f4aa6
Date: Tue, 7 May 2019 15:40:20 +0200
1f4aa6
Subject: [PATCH] power: Only disable Suspend/Hibernate actions inside VM
1f4aa6
1f4aa6
While we theoretically only want a different default value inside a VM,
1f4aa6
we currently hack this by never doing a suspend action inside VMs.
1f4aa6
However, that also breaks automatic logout, which is an unintended side
1f4aa6
effect.
1f4aa6
1f4aa6
Move the check to not install the corresponding timeout (preventing
1f4aa6
sleep warnings from being displayed) and also only enforce the VM
1f4aa6
specific hack for the Suspend and Hibernate actions.
1f4aa6
---
1f4aa6
 plugins/power/gsd-power-manager.c | 15 ++++++++-------
1f4aa6
 1 file changed, 8 insertions(+), 7 deletions(-)
1f4aa6
1f4aa6
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
1f4aa6
index 82d81e96..e103a8a7 100644
1f4aa6
--- a/plugins/power/gsd-power-manager.c
1f4aa6
+++ b/plugins/power/gsd-power-manager.c
1f4aa6
@@ -1550,13 +1550,6 @@ idle_set_mode (GsdPowerManager *manager, GsdPowerIdleMode mode)
1f4aa6
                 return;
1f4aa6
         }
1f4aa6
 
1f4aa6
-        /* don't do any power saving if we're a VM */
1f4aa6
-        if (manager->priv->is_virtual_machine) {
1f4aa6
-                g_debug ("ignoring state transition to %s as virtual machine",
1f4aa6
-                         idle_mode_to_string (mode));
1f4aa6
-                return;
1f4aa6
-        }
1f4aa6
-
1f4aa6
         manager->priv->current_idle_mode = mode;
1f4aa6
         g_debug ("Doing a state transition: %s", idle_mode_to_string (mode));
1f4aa6
 
1f4aa6
@@ -1769,6 +1762,14 @@ idle_configure (GsdPowerManager *manager)
1f4aa6
         clear_idle_watch (manager->priv->idle_monitor,
1f4aa6
                           &manager->priv->idle_sleep_warning_id);
1f4aa6
 
1f4aa6
+        /* don't do any power saving if we're a VM */
1f4aa6
+        if (manager->priv->is_virtual_machine &&
1f4aa6
+            (action_type == GSD_POWER_ACTION_SUSPEND ||
1f4aa6
+             action_type == GSD_POWER_ACTION_HIBERNATE)) {
1f4aa6
+                g_debug ("Ignoring sleep timeout with suspend action inside VM");
1f4aa6
+                timeout_sleep = 0;
1f4aa6
+        }
1f4aa6
+
1f4aa6
         if (timeout_sleep != 0) {
1f4aa6
                 g_debug ("setting up sleep callback %is", timeout_sleep);
1f4aa6
 
1f4aa6
-- 
1f4aa6
2.26.2
1f4aa6