summarylogtreecommitdiffstats
path: root/0001-Add-a-critical-action-Ignore.patch
blob: 3f0e6f888ff3993885e2c802ca960acca1acfea9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
diff -rU3 upower.orig/etc/UPower.conf upower/etc/UPower.conf
--- upower.orig/etc/UPower.conf	2024-05-06 13:57:43.520236008 +0200
+++ upower/etc/UPower.conf	2024-05-06 13:58:36.086904557 +0200
@@ -96,8 +96,9 @@
 # Hibernate
 # HybridSleep
 # Suspend (AllowRiskyCriticalPowerAction should be true to use this option but risky)
+# Ignore
 #
 # If Suspend isn't available or AllowRiskyCriticalPowerAction=false, HybridSleep will be used
 # If HybridSleep isn't available, Hibernate will be used
 # If Hibernate isn't available, PowerOff will be used
-CriticalPowerAction=HybridSleep
+CriticalPowerAction=Ignore
diff -rU3 upower.orig/src/linux/up-backend.c upower/src/linux/up-backend.c
--- upower.orig/src/linux/up-backend.c	2024-05-06 13:57:43.523569342 +0200
+++ upower/src/linux/up-backend.c	2024-05-06 14:03:10.736914407 +0200
@@ -557,6 +557,7 @@
 		{ "HybridSleep", "CanHybridSleep" },
 		{ "Hibernate", "CanHibernate" },
 		{ "PowerOff", NULL },
+		{ "Ignore", NULL },
 	};
 	g_autofree gchar *action = NULL;
 	gboolean can_risky = FALSE;
@@ -622,6 +623,11 @@
 	method = up_backend_get_critical_action (backend);
 	g_assert (method != NULL);
 
+	/* Do nothing if the action is set to "Ignore" */
+	if (g_strcmp0 (method, "Ignore") == 0) {
+		return;
+	}
+
 	/* Take action */
 	g_debug ("About to call logind method %s", method);
 	g_dbus_proxy_call (backend->priv->logind_proxy,