-
-
Save mtgrosser/4497691 to your computer and use it in GitHub Desktop.
Control the LEDs on your Pogoplug E02 with Arch Linux ARM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
GREEN="green:health" | |
ORANGE="orange:fault" | |
usage() | |
{ | |
echo "USAGE: led (all|orange|green) (off|on|blink|heartbeat|fs) [only]" | |
exit 1 | |
} | |
switch() | |
{ | |
echo "$2" > "/sys/class/leds/status:${1}/trigger" | |
} | |
if [ "$1" == "--help" ]; then | |
usage | |
fi | |
if [ "$3" == only ]; then | |
switch "$GREEN" none | |
switch "$ORANGE" none | |
fi | |
case "$2" in | |
off) MSG="none" ;; | |
on) MSG="default-on" ;; | |
blink) MSG="timer" ;; | |
heartbeat) MSG="heartbeat" ;; | |
fs) MSG="usb-host" ;; | |
*) usage ;; | |
esac | |
case "$1" in | |
all) switch "$GREEN" "$MSG"; switch "$ORANGE" "$MSG" ;; | |
orange) switch "$ORANGE" "$MSG" ;; | |
green) switch "$GREEN" "$MSG" ;; | |
*) usage ;; | |
esac |
Updated for the latest linux-kirkwood kernel, which changed LED paths
Thanks for this LED control!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copy to /usr/local/sbin/led and chmod +x