Is there any way to control the LEDs as a non-admin user? Currently, I can only do the following. I’ve only been able to get it to work by doing “sudo su”:
echo 0 > brightness
The following does NOT work for some reason:
sudo echo 0 > brightness
Is there an alternate way to control the LEDs as a non-admin user, with a Python library maybe?
Looks like “brightness” is owned by the system user and other users only have read permission.
Since “brightness” is simply a file in these directories you can use chmod to grant write permission to everyone:
sudo chmod 746 brightness
Then the file will be writable by any user. A simple python program would be able to change the contents of the file to 0 or 1.
led0 = open('/sys/class/leds/usr_led0/brightness','w')