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