I know the trigger for on-board leds can be controlled from the command-line (or a script) I have a python program that I want to temporarily take over the system led blink it a little and return control to the trigger it had previously. I know I can read the current trigger by
cat /sys/class/leds/led0/trigger and set it by
echo mmc0 >/sys/class/leds/led0/trigger.
When I tried to do:
Nothing changed even though python did not complain (as long as it was started as root, which is another problem in itself).
Edit: I tried treating
/sys/class/leds/led1/trigger like a regular ASCII file and opened it using
sudo vi, erased the whole line with 'none' and it worked. Tried again and replaced the line with 'input' and it went back to its original trigger. So it seems like it can be treated like a regular text file. (I don't fully understand how it works just what it seems like)
I know that I can call:
os.system("echo input | sudo tee /sys/class/leds/led1/trigger > /dev/null")
However since the program is in python I was wondering if it can be controlled from within python without making a system call and how to do that.