summaryrefslogtreecommitdiffstats
path: root/src/shared/sleep-config.h
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-11-13 18:08:05 +0100
committerLuca Boccassi <bluca@debian.org>2023-01-27 21:52:12 +0100
commit4f58b656d92b09a953b7cffcfd1ee6d5136a57ed (patch)
treedaebdcf6edbbdf02694ded0566b00c77c3e0bb39 /src/shared/sleep-config.h
parentsleep: drop unnecessary temporal vaiable and initialization (diff)
downloadsystemd-4f58b656d92b09a953b7cffcfd1ee6d5136a57ed.tar.xz
systemd-4f58b656d92b09a953b7cffcfd1ee6d5136a57ed.zip
sleep: introduce SuspendEstimationSec=
Before v252, HibernateDelaySec= specifies the maximum timespan that the system in suspend state, and the system hibernate after the timespan. However, after 96d662fa4c8cab24da57523c5e49e6ef3967fc13, the setting is repurposed as the default interval to measure battery charge level and estimate the battery discharging late. And if the system has enough battery capacity, then the system will stay in suspend state and not hibernate even if the time passed. See issue #25269. To keep the backward compatibility, let's introduce another setting SuspendEstimationSec= for controlling the interval to measure battery charge level, and make HibernateDelaySec= work as of v251. This also drops implementation details from the man page. Fixes #25269.
Diffstat (limited to 'src/shared/sleep-config.h')
-rw-r--r--src/shared/sleep-config.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/shared/sleep-config.h b/src/shared/sleep-config.h
index 813f33c7c0..99423fe3d3 100644
--- a/src/shared/sleep-config.h
+++ b/src/shared/sleep-config.h
@@ -6,6 +6,8 @@
#include "hashmap.h"
#include "time-util.h"
+#define DEFAULT_SUSPEND_ESTIMATION_USEC (1 * USEC_PER_HOUR)
+
typedef enum SleepOperation {
SLEEP_SUSPEND,
SLEEP_HIBERNATE,
@@ -20,6 +22,7 @@ typedef struct SleepConfig {
char **modes[_SLEEP_OPERATION_MAX];
char **states[_SLEEP_OPERATION_MAX];
usec_t hibernate_delay_usec;
+ usec_t suspend_estimation_usec;
} SleepConfig;
SleepConfig* free_sleep_config(SleepConfig *sc);