Open 3flex opened 4 months ago
I am not sure what you are requesting? we do use _BTP already. What else do you want?
The system will switch to hibernate if either:
I would like:
_BTP is a way to implement this as it allows setting the alarm threshold - I had a quick look at source, and systemd doesn't seem to set the alarm at all.
1) is a duplicate of https://github.com/systemd/systemd/issues/27839
Thanks, I didn't see that - it's similar but not the same, as that issue asks that a static threshold of capacity remaining is set e.g. always hibernate if capacity remaining reaches or is below 50%, while I'm asking for configurable battery drain amount to trigger hibernate when there's a lot of battery remaining, while also ensuring there's at least enough battery left for a certain amount of usage time.
Component
No response
Is your feature request related to a problem? Please describe
Device with battery using suspend-then-hibernate should stay asleep without polling battery state. Waking the system creates unnecessary power drain when better options exist.
Switching to hibernate should also not depend on either timers, or remaining battery percentage dropping to 5%. Though waiting until 5% remaining avoids data loss it does not allow the machine to run for very long when it's started up again if the user is not near a power source and may be insufficient to even hibernate if it's an older device with an older battery.
Describe the solution you'd like
Device with battery and ACPI _BTP (battery trip point) support should allow suspend-then-hibernate to switch to hibernate only when battery drain exceeds a specified threshold (default 5%) or drops below a threshold where the use time remaining is insufficient.
Modern Standby on Windows requires this behaviour and does not user any timers or polling to determine when to switch to hibernate mode. They specifically list the benefit of "Eliminate resuming to a dead battery" which the systemd implementation does not (sure there should be 5% left but that's near enough to dead).
There are two ways to determine when to switch from suspend to hibernate:
These are all required on modern Windows machines, but it would still require a fall back to the timer method in case required ACPI methods & data are not available.
The relevant value can be calculated, then _BTP will be called to set the battery trip point, which will send notify event through ACPI so the system can take action and hibernate.
Using this kind of implementation means there can be sane defaults that are not time-based and will:
Describe alternatives you've considered
Using the existing methods which have issues with polling or setting arbitrary values that are system-specific instead of using the data & features available in firmware to provide the best possible user experience.
The systemd version you checked that didn't have the feature you are asking for
No response