diff options
author | Mike Yuan <me@yhndnzj.com> | 2023-02-20 13:12:19 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-02-21 20:48:33 +0100 |
commit | e0b3a70fabb871bf55678e9e177445b1df2aee88 (patch) | |
tree | ae28c74109133b4db42cd1ab6c17f498280c1e41 /src/shared/sleep-config.h | |
parent | install: fail early if specifier expansion failed (diff) | |
download | systemd-e0b3a70fabb871bf55678e9e177445b1df2aee88.tar.xz systemd-e0b3a70fabb871bf55678e9e177445b1df2aee88.zip |
sleep: check if we're on AC power before checking battery capacity
Before this commit, battery_is_low() returns
true if there's no battery on the system.
It's now modified to check if the system is
on AC power first, and returns false early
if that's the case.
Fixes #26492
Diffstat (limited to 'src/shared/sleep-config.h')
-rw-r--r-- | src/shared/sleep-config.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/shared/sleep-config.h b/src/shared/sleep-config.h index 99423fe3d3..5c528b890b 100644 --- a/src/shared/sleep-config.h +++ b/src/shared/sleep-config.h @@ -60,7 +60,7 @@ int find_hibernate_location(HibernateLocation **ret_hibernate_location); int can_sleep(SleepOperation operation); int can_sleep_disk(char **types); int can_sleep_state(char **types); -int battery_is_low(void); +int battery_is_discharging_and_low(void); int get_total_suspend_interval(Hashmap *last_capacity, usec_t *ret); int fetch_batteries_capacity_by_name(Hashmap **ret_current_capacity); int get_capacity_by_name(Hashmap *capacities_by_name, const char *name); |