WikiDevi.Wi-Cat.RU:DD-WRT/LED Scripts

'''The example LED scripts below are written using the GPIO info for the Linksys WRT. Remember to change them for whatever router you have.'''

You can't use the GPIOS on Atheros chips (Fonera, Meraki, etc.) without PROC_GPIO or some other utility. PROC_GPIO is a driver, and thus it must be compiled for your specific kernel. Broadcom routers do not need an external driver to drive GPIOs.

GPIO Info for Linksys WRT
Pin	Direction	Name		Use GPIO 0	Output	WLAN LED  	(LED - wireless) GPIO 1	Output	POWER LED	(LED - power) GPIO 2	Output	ADM_EECS  	(LED - white, Cisco button v. 3.0+) GPIO 3	Output	ADM_EESK 	(LED - amber, Cisco button v. 3.0+) GPIO 4	Input	ADM_EEDO 	(Button - Cisco Button v. 3.0+) GPIO 5	Output	ADM_EEDI   	(Unknown) Seems to cycle all LED colors disabled. GPIO 6	Input	RESET		(Button - reset button) GPIO 7	Output	DMZ LED		(LED - DMZ)

GPIO Info for Linksys WRT150N v1.1 (dd-wrt.v24_mini_generic)
Here is a short summary of my experiments with WRT150N v1.1 on dd-wrt.v24_mini_generic firmware. WRT150N has a SECURITY LED (the most right LED)

root@DD-WRT:~# gpio enable 5 #(SECURITY LED - off - green) root@DD-WRT:~# gpio disable 5 #(SECURITY LED - on - green) root@DD-WRT:~# gpio disable 3 #(SECURITY LED - on - amber) root@DD-WRT:~# gpio enable 3 #(SECURITY LED - off - amber)

When you switched to gpio disable 3 (SECURITY LED - on - amber) root@DD-WRT:~# gpio enable 5 #(SECURITY LED - will give you amber) root@DD-WRT:~# gpio disable 5 #(SECURITY LED - will give you amber bright)

GPIO Info for Linksys WRTSL54GS
This is for the WRTSL54GS model only. Pin    Direction       Name            Use GPIO 5 OUTPUT          SES LED         (Cisco white LED) GPIO 7 OUTPUT          SES LED         (Cisco amber LED)

GPIO Info for Buffalo WHR
Pin	Direction	Use GPIO 0	Input		AOSS button GPIO 1	Output		Bridge LED GPIO 2	Output		WLAN LED GPIO 3	Output		Extra LED between bridge and WLAN GPIO 4	Input		Reset button GPIO 5	Input		Bridge/auto switch GPIO 6	Output		AOSS LED GPIO 7	Output		DIAG LED GPIO 8	n/a		Unkown/none GPIO 9	Output		Power LED

GPIO Info for LaFonera 2100
Pin	Use 0	TP3 1	pin 5 of SW1 2	WLAN LED 3	pin 1 of SW1 4	pin 2 of SW1 5	Reset (!) 6	Reset button 7	pin 6 of SW1
 * According to this link

La Fonera 2200
2 WIFI LED contact at bottom of local resistor 5 Reset! (Can be used as a GPIO, but you lose reset functionality) This is the line closest to the RP4 component (next to 3 other lines, GPIOS 6, 2, and 7) Cut the trace and use the end closest to the CPU as a GPIO. 6 Reset button (other end of button is VDD, (3.3 V)) remove nearby capacitor 7 Power LED contact at bottom of local resistor

La Fonera 2201
1 WLAN Orange LED 2 WLAN Green LED 4 Power Green LED 7 Power Orange LED

GPIO Button Wifi Toggle D-Link DIR-300
This script will enable the button on the righte side to act as a wifitoggle. on press the button-led will light up
 * RED, when wifi is going to be disabled. wifi-led on the front will go out.
 * BLUE, when wifi is going to be enabled again. wifi-led on the front will light up.

GPIO Info D-Link DIR-320
For GPIO information, send a private message to DD-WRT user "meltyblood"

To turn cisco led blue / white ...
Per Eko here

Yellow cisco led on Linksys routers means that router got WAN ip. If you prefer it blue (white, ..) do:

In latest builds only (13522+):

Display Load via LED (load.sh)

 * Uses front button LED to display current load on router.
 * For WRT54G/GL/GS

Modified Script for simple display of cpu usage/load -- I use the power LED Low activity/idle (led off), medium (short flashes), high (long flashes), max (led on solid)

WDS link and/or associated wireless clients

 * illuminates front button LED white when able to ping the gateway
 * illuminates front button LED amber when wireless clients are connected
 * illuminates both colors on the button when both conditions are true
 * no light when neither condition is true
 * developed / tested on a WRT54G-TM

WLAN Status (wlan.sh)
Works on k2.4 and k2.6


 * Uses front button LED to show WLAN state. Amber LED indicates one or more associated clients, white LED flashes when data is sent over WLAN.

WLAN Status (wlan.sh) - Buffalo Routers

 * AOSS LED to show WLAN is associated with clients.
 * Bridge LED flashes when data is transmitted over WLAN.

WLAN Client Mode Status
Works on k2.4 and k2.6 Works on Repeater Bridge as well


 * White LED if we can ping the gateway
 * Orange LED if associated to an AP, but pinging fails.

WLAN Disable Radio If No Clients Connected
This is a cron job that will run every hour and turn off the radio if no clients are connected as requested here.

Show VPN status/activity with SES/Cisco LED
I worked out this little script out for my WRT54G-TM and WRT54GL and I thought I would share here since its based from examples shown on this forum and the wiki.

The script requires that you set 2 options in your vpn config file:

For activity it parses the info in /proc/net/dev

Be sure to edit the first 2 lines (VPN_STATUS= and VPN_DEV=) of this script to match your settings.. then Paste the following into your Startup script. Code:

Reboot your router and viola!

Light off = Tunnel down White = Tunnel up Amber = Activity

You can change the behavior of this script by changing each LED=$COLOR line.

Response time for tunnel up/down indication for my setup is 60sec for client connect and 120sec for disconnect. I believe the disconnect response could be improved by changing your keepalive setting in your VPN config.

Mine is set to: keepalive 10 120

This means OpenVPN will ping the client every 10sec and assume the client has disconnect if no reply is received within 120sec. lowering the last value should improve the response time but be careful not to lower it too much as not to cause connection drops due to timeout

Hope this helps, -onemyndseye Original Post

Update: Fun with egrep!

Here is an updated version that will monitor for activity on ANY tap or tun device that exists. Still only showing up/down status for 1 tunnel

USB Disc Mount Status and Umount Button (DIR-320 running v24-sp2 mini-usb-ftp)

 * SES red LED to indicate disc mounted
 * SES button to umount disc
 * SES blue LED to indicate umounting proccess

Script /jffs/etc/config/mount_status.startup (disc mount status)

Script /jffs/etc/config/mount.sesbutton

Display signal strength over the SES light - Linksys router
http://www.dd-wrt.com/phpBB2/viewtopic.php?p=461193 Use this script If you want to catch a better signal without computers.

Script not work in dd-wrt micro version

Linksys routers where this script will work :

- WRT54GL v1.0 - WRT54GL v1.1 - WRT54G-TM - WRT54G v4.0

Linksys routers where the script does not work: - WRT54GS v6.0 - WRT54G v5 - WRTSL54GS

has not yet been tested on other models

Discuss here.

Script Version 1
- No signal or very weak

- Low signal

- Good signal

- Excellent signal

Installation is pretty simple:

1. Go to "Administration -> Commands" 2. Paste script in "Command Shell" 3. Click on "Save Startup" 4. Reboot router

Works great in Client mode and Repeater mode

To work in AP mode, you must put the mac address

Script Version 2
Script version two show signal more precise

SIGNAL STRENGTH
 * 0 blink = SNR < 9 No signal or very weak
 * 1 blink = SNR 10-19
 * 2 blinks = SNR 20-29
 * 3 blinks = SNR 30-39
 * 4 blinks = SNR 40-49
 * 5 blinks = SNR 50-59
 * 6 blinks = SNR 60 > Excellent signal