Skip to content

Instantly share code, notes, and snippets.

@mtgrosser
Last active September 8, 2020 19:09
Show Gist options
  • Save mtgrosser/4497691 to your computer and use it in GitHub Desktop.
Save mtgrosser/4497691 to your computer and use it in GitHub Desktop.
Control the LEDs on your Pogoplug E02 with Arch Linux ARM
#!/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
@wheelthru
Copy link

Thanks for this LED control!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment