main/postmarketos-base: change permission on tm2-touchkey leds
This additional udev rule allows unpriviliged users to turn on/off the tm2-touchkey leds by echo 1 > /sys/class/leds/tm2-touchkey/brightness
or echo 0 accordingly.
Until now, this needs to be done with sudo, e.g. echo 1 | sudo tee /sys/class/leds/tm2-touchkey/brightness
or sudo /bin/sh -c 'echo 1 > /sys/class/leds/tm2-touchkey/brightness'
.
The change is mainly beneficial for usage in userspace scripts . This way it's much easier to set up scripts for event-based handling of the leds.
Changing the permission the udev way by KERNEL=="tm2-touchkey", MODE="0666"
did not work. Probably because of the same reason why turning them on/off by KERNEL=="tm2-touchkey", ATTR{brightness}="0"
did not work. The latter causes a dmesg message saying udevd[...]: error opening ATTR{/sys/bus/i2c/drivers/tm2-touchkey/brightness} for writing: Permission denied
. The reason for the message seems that the node /sys/bus/i2c/drivers/tm2-touchkey/brightness does not exist. I don't know why udev tries to handle it via /sys/bus/i2c.
Because of this, the permission on the tm2-touchkey leds are changed by a shell command within the udev rule.