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

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