You are not logged in.

#1 2017-09-06 06:06:38

hendry
Member
From: Singapore
Registered: 2009-09-08
Posts: 157
Website

Suspending only when both batteries together are low

Hi,

I'm using https://wiki.archlinux.org/index.php/La … tery_level

/etc/udev/rules.d$ cat 99-lowbat.rules
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="[0-5]", RUN+="/usr/bin/systemctl suspend"

And since I have two batteries, if one is depleted, my Thinkpad T460s goes to sleep. This is annoying since I have another battery it could have used!
Any ideas how I have a udev rule for all my batteries? Or am I missing something simple here?

Thank you,

Offline

#2 2017-09-08 23:36:43

GenkiSky
Member
From: This account is henceforth dis
Registered: 2017-04-04
Posts: 82

Re: Suspending only when both batteries together are low

Have you confirmed that both batteries report discharge events to udev? (See the "Note" box in the section you linked). If so, you could probably replace the script inside "RUN" in that rule to run a custom script of your own, where it checks the battery levels of both batteries (e.g. via /sys/class/power_supply/BAT<N>/capacity) and only calls "/usr/bin/systemctl suspend" if both are low.

Last edited by GenkiSky (2017-09-09 00:57:25)

Offline

Board footer

Powered by FluxBB