diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-11-13 18:08:05 +0100 |
---|---|---|
committer | Luca Boccassi <bluca@debian.org> | 2023-01-27 21:52:12 +0100 |
commit | 4f58b656d92b09a953b7cffcfd1ee6d5136a57ed (patch) | |
tree | daebdcf6edbbdf02694ded0566b00c77c3e0bb39 /src/shared/sleep-config.h | |
parent | sleep: drop unnecessary temporal vaiable and initialization (diff) | |
download | systemd-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.h | 3 |
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); |