OpenWrt Forum Archive

Topic: [howto] led for WDS activity

The content of this topic has been archived on 18 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

How to configure a spare led to show WDS activity

This guide will help you setup a new led to report activity on the WDS segment of your LAN bridge, just like the other ports in the Ethernet bridge. Tested on a TP-LINK WR1043ND with v.12.09, some changes might be required. Config and script are my work.

1. configure WDS as shown here: http://wiki.openwrt.org/doc/recipes/atheroswds

2. identify a spare led (I chose QSS) and edit /etc/config/system (directly or via UCI) accordingly:

config led 'led_wds'
        option name 'WDS'
        option sysfs 'tp-link:green:qss'
        option default '0'
        option trigger 'netdev'
        option mode 'tx rx'

3. place the following script under /etc/hotplug.d/net as 20-led-wds:

#!/bin/sh
# WDS led configuration script for OpenWRT
# Author: Andrea Borgia <andrea@borgia.bo.it>
# License: GPLv2

CFGNAME="system.led_wds"
LED=`uci get $CFGNAME`

if [ "${LED}" != "led" ]; then
        logger -t WDS Missing led configuration
else
        if [ ! "${INTERFACE##wlan0*.sta*}" ]; then
                logger -t WDS Interface: $INTERFACE / Action: $ACTION
                if [ $ACTION == "add" ]; then
                        uci set "${CFGNAME}.dev"="${INTERFACE}"
                        uci commit
                        /etc/init.d/led start
                else
                        uci set "${CFGNAME}.dev"=""
                        uci commit
                        /etc/init.d/led start
                fi 
        fi
fi

As soon as the WDS node comes online the wlan.sta* interface is configured as the led device name; when the node goes offline, it will be removed once the timeout expires and the wlan.sta* interface goes down. Reboot and enjoy smile
EDIT: added "*" in the wlan interface test, to catch secondary SSIDs on the same radio.

(Last edited by aboaboit on 17 Dec 2013, 23:20)

Please edit your post and use code tags. Makes it much more readable :-)

hi, great,

thanks for the script.

I wonder where shall I look the other lights?

option sysfs 'tp-link:green:qss'

Check under /sys/class/leds on your router: those are the leds recognized for your architecture.

The discussion might have continued from here.