~mil/sxmo-tickets#293: 
Use upower and shutdown on low power

Status
REPORTED
Submitter
~anjan
Assigned to
No-one
Submitted
3 years ago
Updated
a month ago
Labels
No labels applied.

~proycon 3 years ago

This seems something that could be integrated into ~noneofyourbusiness 's new low battery daemon? https://lists.sr.ht/~mil/sxmo-devel/patches/23345

~stacyharper 3 years ago

~proycon outgoing@sr.ht wrote:

This seems something that could be integrated into ~noneofyourbusiness 's new low battery daemon? https://lists.sr.ht/~mil/sxmo- devel/patches/23345

Yes I didnt tried this version atm

~noneofyourbusiness 3 years ago

Interesting - but sounds like it's more or less doing what cron+rtcwake is planned to do

~sicelo a month ago*

while sxmo did eventually switch to upower, it is important to note that upower does not actually handle the shutdown on low power itself, but simply places a shutdown request to logind [1]

This means automatic shutdown on low power is not working under sxmo since it is not logind compliant. Assuming this is not planned to be changed in the foreseeable future, maybe sxmo should at least be on the lookout for upower's action state/signal, then initiate the shutdown action manually

[1] https://gitlab.freedesktop.org/upower/upower/-/blob/1146047df93c0da14bdd3e5a31b691289e96a84c/src/linux/up-backend.c#L615-623

~magdesign a month ago*

copy this: https://codeberg.org/magdesign/sxmop6/src/branch/main/hooks/sxmo_hook_battery.sh to ~/.config/sxmo/hooks/sxmo_hook_battery.sh it will grep the values from UPower.conf file and handles the warnings and shutdown.... i tried for several hours (pmos edge, sway, op6) and it does the job. feel free to test and merge.

be aware that:

  • calling sxmo_power.sh poweroff will not turn off the device (dont know why it hangs)
  • power reporting of UPower might leave out values and jump e.g. from 5% to 2%
Register here or Log in to comment, or comment via email.