diff options
author | Sonali Srivastava <srivastava.sonali1@gmail.com> | 2022-07-27 08:23:21 +0200 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2022-08-09 18:13:35 +0200 |
commit | 746cf8980b204d7aa60d567a6223e0a5409f44f6 (patch) | |
tree | e610fdeb11bc64b9dda0d49dbbe937e854ee160b /src/shared/sleep-config.h | |
parent | NEWS: add entries for v252 (diff) | |
download | systemd-746cf8980b204d7aa60d567a6223e0a5409f44f6.tar.xz systemd-746cf8980b204d7aa60d567a6223e0a5409f44f6.zip |
sleep: support multiple battery instead of only BAT0
Diffstat (limited to 'src/shared/sleep-config.h')
-rw-r--r-- | src/shared/sleep-config.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/shared/sleep-config.h b/src/shared/sleep-config.h index a48cf17a54..54fe65007e 100644 --- a/src/shared/sleep-config.h +++ b/src/shared/sleep-config.h @@ -2,6 +2,8 @@ #pragma once #include <linux/fiemap.h> + +#include "hashmap.h" #include "time-util.h" typedef enum SleepOperation { @@ -55,10 +57,14 @@ 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 read_battery_capacity_percentage(void); int battery_is_low(void); -int get_battery_discharge_rate(void); -int put_battery_discharge_rate(int estimated_battery_discharge_rate); +int get_total_suspend_interval(Hashmap *last_capacity, usec_t *ret); +int fetch_batteries_capacity_by_name(Hashmap **ret_current_capacity); +int estimate_battery_discharge_rate_per_hour( + Hashmap *last_capacity, + Hashmap *current_capacity, + usec_t before_timestamp, + usec_t after_timestamp); const char* sleep_operation_to_string(SleepOperation s) _const_; SleepOperation sleep_operation_from_string(const char *s) _pure_; |