You are not logged in.
Pages: 1
Hi there,
I'm trying to define a udev rule that triggers a script of mine at a certain level of battery charge (e.G. five percent). Unfortunately nothing happens (cross-checked the x-bit and typos already)
low-battery.rules:
KERNEL=="BAT0", ATTR{status}=="Discharging", ATTR{capacity}=="5", RUN+="/usr/local/bin/backlight"
That's the part of udevadm I took as a ref point for the rules file:
looking at device '/devices/LNXSYSTM:00/device:00/PNP0C0A:00/power_supply/BAT0':
KERNEL=="BAT0"
SUBSYSTEM=="power_supply"
DRIVER==""
ATTR{type}=="Battery"
ATTR{alarm}=="0"
ATTR{charge_full_design}=="2261000"
ATTR{current_now}=="2945000"
ATTR{charge_now}=="1244000"
ATTR{charge_full}=="2261000"
ATTR{capacity}=="55"
ATTR{status}=="Charging"
ATTR{voltage_now}=="11549000"
ATTR{model_name}=="Primary"
ATTR{manufacturer}=="Hewlett-Packard"
ATTR{technology}=="Li-ion"
ATTR{cycle_count}=="0"
ATTR{voltage_min_design}=="10800000"
ATTR{serial_number}=="26362 2013/05/10"
ATTR{present}=="1"
Offline
I don't think that most computers send events when the battery percentage changes. I think it might be better to simply run a cron job that checks for battery level and reacts accordingly (or a systemd.timer).
Offline
Hmm, so which events can be triggered then? I thought udev is universal in that respect to interpret whatever sysfs provides.
Offline
Pages: 1