changing Pogoplug LED color

This forum is for Marvell Kirkwood devices such as the GoFlex Home/Net, PogoPlug v1/v2, SheevaPlug, and ZyXEL devices.

changing Pogoplug LED color

Postby permitivity » Thu Jun 13, 2013 2:05 pm

There's an older thread on how to change the LED color, but the info seems outdated.

In Motion, there is a way to run a command when event starts, and run another command when motion event ends. I'd like to stick in a color change LED command (go green on start, go back to orange when event ends).

This thread does color changes, but runs it at the beginning based on some conditions I don't understand.
viewtopic.php?f=18&t=2101&start=10
permitivity
 
Posts: 141
Joined: Mon Feb 18, 2013 3:08 am


Re: changing Pogoplug LED color

Postby calzon65 » Fri Jun 14, 2013 4:18 pm

Here are some commands you can play with if you want to build a script to control the LEDs. I am running the latest version of ArchLinuxARM and actually completed a full reinstall about a week ago. These settings all work on my PogoPlug V2, yes, I know the Orange LED is normally referred to as “:blue”, but on my system it’s “:orange”. This might be due to the fact that when I configured my system I set the machid to dd6 (fw_setenv machid dd6). So when I checked /sys/class/leds I was surprised to see ":orange" and ":green" versus ":blue" and ":green", or maybe the version of ArchLinuxARM was recently updated for the PogoPlug. In either case I don't know but I know these commands work on my PogoPlug V2.


Turn Orange LED off:
echo none > /sys/class/leds/status\:orange\:fault/trigger

Turn Orange LED on:
echo default-on > /sys/class/leds/status\:orange\:fault/trigger

Turn Orange LED blinking:
echo timer > /sys/class/leds/status\:orange\:fault/trigger

Turn Orange LED heartbeat:
echo heartbeat > /sys/class/leds/status\:orange\:fault/trigger

Turn Green LED off:
echo none > /sys/class/leds/status\:green\:health/trigger

Turn Green LED on:
echo default-on > /sys/class/leds/status\:green\:health/trigger

Turn Green LED blinking:
echo timer > /sys/class/leds/status\:green\:health/trigger

Turn Green LED heartbeat:
echo heartbeat > /sys/class/leds/status\:green\:health/trigger


Grayman4hire, to make your script work, I had to make some changes. Also, I don't understand the purpose of the [only] option.

$this->bbcode_second_pass_code('', '#!/bin/bash

usage()
{
echo "USAGE: led (all|orange|green) (off|on|blink|heartbeat|fs) [only]"
exit 1
}

switch()
{
echo "$2" > "/sys/class/leds/status:$1:$3/trigger"
}

if [ "$1" == "--help" ]; then
usage
fi

if [ "$3" == only ]; then
switch green none health
switch orange none fault
fi

case "$2" in
off) MSG="none" ;;
on) MSG="default-on" ;;
blink) MSG="timer" ;;
heartbeat) MSG="heartbeat" ;;
fs) MSG="mmc0" ;;
*) usage ;;
esac

case "$1" in
all) switch green "$MSG" health; switch orange "$MSG" fault ;;
orange) switch orange "$MSG" fault ;;
green) switch green "$MSG" health ;;
*) usage ;;
esac')
calzon65
 
Posts: 80
Joined: Wed May 25, 2011 9:06 pm

Re: changing Pogoplug LED color

Postby grayman4hire » Fri Jun 14, 2013 5:53 pm

@calzon65

Thanks for sharing! Just for clarification, that's not my script. Just something I found googling.
grayman4hire
 
Posts: 350
Joined: Sat Sep 29, 2012 12:03 am
Location: SF, CA

Re: changing Pogoplug LED color

Postby calzon65 » Fri Jun 14, 2013 6:22 pm

Thanks for the clarification. I'm not sure what the original author intended with the only option, for now I will probably just delete it.
calzon65
 
Posts: 80
Joined: Wed May 25, 2011 9:06 pm

Re: changing Pogoplug LED color

Postby permitivity » Fri Jun 14, 2013 7:21 pm

$this->bbcode_second_pass_quote('calzon65', 'H')ere are some commands you can play with if you want to build a script to control the LEDs....


Wow, thanks for the tip. I'm a Linux newbie, so I wasn't sure with what to do with the scripts. If I could just run commands, I think that's all I need.

I'll try testing out these commands. I'll also try and see if blinking or heartbeat consumes more system resources than steady on/off. Also, it kinda looks like you could run the two "on" commands to make both green and orange on at the same time.
permitivity
 
Posts: 141
Joined: Mon Feb 18, 2013 3:08 am

Re: changing Pogoplug LED color

Postby calzon65 » Fri Jun 14, 2013 7:56 pm

Yes you can turn both on at the same time, but it's a bit hard to distinguish the "combined" color.

Here is the script with the [only] option removed:
$this->bbcode_second_pass_code('', '#!/bin/bash

usage()
{
echo "USAGE: led (all|orange|green) (off|on|blink|heartbeat|fs)"
exit 1
}

switch()
{
echo "$2" > "/sys/class/leds/status:$1:$3/trigger"
}

if [ "$1" == "--help" ]; then
usage
fi

case "$2" in
off) MSG="none" ;;
on) MSG="default-on" ;;
blink) MSG="timer" ;;
heartbeat) MSG="heartbeat" ;;
fs) MSG="mmc0" ;;
*) usage ;;
esac

case "$1" in
all) switch green "$MSG" health; switch orange "$MSG" fault ;;
orange) switch orange "$MSG" fault ;;
green) switch green "$MSG" health ;;
*) usage ;;
esac')
calzon65
 
Posts: 80
Joined: Wed May 25, 2011 9:06 pm

Re: changing Pogoplug LED color

Postby grayman4hire » Fri Jun 14, 2013 8:46 pm

Thanks for updating the script @calxon65!

@permitivity, I'm not in front of my pogoplug, so I can't tell you if this actually works, but try the below.

$this->bbcode_second_pass_code('', '
cd /usr/local/bin
wget http://dl.dropbox.com/u/42238/pogoplug/v2/led
chmod a+x led

led
led green blink
')

A little off topic, but is "/usr/local/bin" a good folder to store custom scripts/binaries?
grayman4hire
 
Posts: 350
Joined: Sat Sep 29, 2012 12:03 am
Location: SF, CA

Re: changing Pogoplug LED color

Postby permitivity » Sat Jun 15, 2013 3:52 am

My orange LED was call the "blue" led. If I went to "/sys/class/leds", I see

$this->bbcode_second_pass_quote('', 'p')lug:red:misc status:blue:health status:green:health


So the commands work pretty much like what you wrote, but with blue instead of orange.

I did do the $this->bbcode_second_pass_quote('', 'f')w_setenv machid dd6
initially once, but I don't know what that does. Oh, and I can turn on both LED's at the same time, or black both, or have one on and blank the other. Neat.

$this->bbcode_second_pass_code('', '
Orange LED off
echo none > /sys/class/leds/status\:blue\:health/trigger


Orange LED on
echo default-on > /sys/class/leds/status\:blue\:health/trigger


Orange LED blinking
echo timer > /sys/class/leds/status\:blue\:health/trigger


Orange LED heartbeat
echo heartbeat > /sys/class/leds/status\:blue\:health/trigger

Turn Green LED off:
echo none > /sys/class/leds/status\:green\:health/trigger

Turn Green LED on:
echo default-on > /sys/class/leds/status\:green\:health/trigger

Turn Green LED blinking:
echo timer > /sys/class/leds/status\:green\:health/trigger

Turn Green LED heartbeat:
echo heartbeat > /sys/class/leds/status\:green\:health/trigger
')
permitivity
 
Posts: 141
Joined: Mon Feb 18, 2013 3:08 am
Top

Re: changing Pogoplug LED color

Postby calzon65 » Sat Jun 15, 2013 5:52 pm

It's strange the Orange LEDs being called "blue", but when I did a complete reinstall about a week ago, my Orange LEDs were also called blue at that time. I've run a few updates pacman -Syu after my complete reinstall, so all I can guess is that during one of the updates, something changed the name of my Orange LEDs in /sys/class/leds to actually be called "orange", I know I didn't change the name myself.

Running fw_setenv machid dd6 sets the correct machine ID to a PogoPlug v2 which makes the LED work properly after reboot. In essence, if you do a complete reinstall and don't set this, the PogoPlug LED will glow Orange after boot, setting the machine ID to dd6 makes the LED green after each reboot.

Maybe my setting the machine ID to dd6 followed by a few pacman -Syu over the past week captured some type of "update" that changed the name of my Orange LED from blue to orange because at that point, my system was "properly identified" as PogoPlug v2. I read a post from moonman saying with a fresh Arch install, the system (on a PogoPlug v2) thinks its a Sheeva Plug because the correct arcNumber is not properly initialized in the kernel, and maybe the Sheeve plug has a Green/Blue LED.

Anyway, after you run the fw_setenv machid dd6 I suggest rebooting then running a pacman -Syu, reboot, pacman -Syu again for grins, then check the name of your LED. I just don't want to go through yet another complete reinstallation to verify my theory.
calzon65
 
Posts: 80
Joined: Wed May 25, 2011 9:06 pm


Return to Marvell Kirkwood

Who is online

Users browsing this forum: No registered users and 5 guests