Skip to content

Instantly share code, notes, and snippets.

@colerd24
Last active October 26, 2019 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colerd24/9b760b25915a836a4bcfc587d6456953 to your computer and use it in GitHub Desktop.
Save colerd24/9b760b25915a836a4bcfc587d6456953 to your computer and use it in GitHub Desktop.
User modifiable LEDs Linux Path:
/sys/class/leds/
Linux Drivers Source Files:
https://github.com/torvalds/linux/tree/master/drivers/leds
Turn on/off (where x is 1 or 0):
echo x | sudo tee "/sys/class/leds/led_name/brightness" # or "brightness" if relative
Triggers:
Disable LED trigger: echo "none" | sudo tee "/path/to/led/trigger"
Change trigger: echo "kbd-capslock" | sudo tee "/path/to/led/trigger"
Heartbeat LED Kernel Module:
modprobe ledtrig_heartbeat
echo "heartbeat" | sudo tee "/path/to/led/trigger"
Allowing Persistent Access from Userspace (no sudo):
ToDo - should be able to use a udev rule like other drivers (alternatives are script or systemd service)
Raspberry Pi Network LEDs:
Controllable through USB commands to Ethernet controller - https://github.com/dumpsite/lan951x-led-ctl
Other Linux devices probably use "phy0tpt" trigger
https://github.com/torvalds/linux/blob/master/drivers/leds/led-class.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment