В /etc/udev/rules.d/91-power.rules написал:
SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="/bin/echo 'off' >> /home/data/test"
SUBSYSTEM=="power_supply", ATTR{online}=="1", RUN+="/bin/echo 'on' >> /home/data/test"
Сделал udevadm control --reload
Вытыкаю/втыкаю кабель.
udevadm monitor показывает:
KERNEL[2672.773310] change /devices/platform/ACPI0003:00/power_supply/AC0 (power_supply)
UDEV [2672.803313] change /devices/platform/ACPI0003:00/power_supply/AC0 (power_supply)
KERNEL[2673.347460] change /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [2673.348692] change /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
KERNEL[2673.352306] change /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [2673.353478] change /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
KERNEL[2679.249270] change /devices/platform/ACPI0003:00/power_supply/AC0 (power_supply)
UDEV [2679.280336] change /devices/platform/ACPI0003:00/power_supply/AC0 (power_supply)
KERNEL[2679.818443] change /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [2679.819827] change /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
KERNEL[2679.823319] change /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [2679.824619] change /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
В файл /home/data/test ничего не пишется. Правило не срабатывает. Почему? :(