Documentation:Linux/LEDs
From AVRFreaks Wiki
[edit] The LED interface
LEDs are controlled by a sysfs interface. It lives in
/sys/class/leds
There is one folder per LED here.
[edit] Attributes
Each LED has a lot of attributes
brightness device power subsystem trigger uevent
The interesting ones are just "brightness" and "trigger". If you simply want to turn the LED on and off, just use the brightness attribute like this (example for LED "a"):
#: echo 1 > /sys/class/led/a/brightness #turn it on #: echo 0 > /sys/class/led/b/brightness #turn it off
[edit] Triggers
An LED may be triggered by a number of events. For example it my come on when there's hard drive or MMC card activity, it may pulse to the systems's "heartbeat" or a number of others. To see the trigger options and the currently selected one, read the trigger attribute of the LED you're interested in.
#: cat /sys/class/led/a/trigger [none] mmc0 timer heartbeat default-onThis shows that the "none" trigger is selected and there are 5 triggers available. To make the LED flash like a heartbeat
#: echo "heartbeat" > /sys/class/led/a/trigger
To make it flash when the mmc card is being accessed
#: echo "mmc0" > /sys/class/led/a/trigger
