IAmTheRockstar

Yes. Yes I am.
You are accessing the archives. Commenting has been disabled, and archive posts are likely to be horribly out of date and, in some cases, rendered oddly because the styles from archive posts are no longer being maintained.
December 10, 2007

OpenWRT LED Fiddlery

In preparation for my talk at NCLUG tomorrow, I've been fiddling around with OpenWRT on a few of my WRT54G devices. One of the things I've most appreciated about many of the embedded linux devices is their attention to detail in getting every little device to work on it. I usually don't spend the time mucking with my desktops to that degree. The cool thing about OpenWRT is that even the front LEDs can be controlled through the /proc filesystem. Since I found myself writing lots of scripts that manipulate these LEDs, I wrote a generic script that I can run from the command line to manipulate the LEDsa as well.

#!/bin/sh

usage () {
  echo "ledset - A program to set led values"
  echo " Usage : ledset led_name value"      
}                                      

if [ $# -ne 2 ]; then
  usage              
  exit 
fi    

if [ -f /proc/diag/led/$1 ] ; then
  echo $2 > /proc/diag/led/$1     
else                         
  echo "No led found named " $1
fi
No comments have been posted yet.
Comments are now closed an archived posts.

All opinions expressed here constitute my personal opinion, and do not necessarily represent the opinion of any other organization or person, including, but not limited to, my fellow employees, my employer, its clients or their agents.