The WRT54GL router has two buttons: one reset button and one called "SecureEasySetup" or SES. After OpenWRT installation this two button do not served. We will see how to give a role to the SES one to toggle the wifi on and off.
Wifi toggle script
First we will create a script that allow us to change the wifi status. It will activate the wifi when it is not and inactivate it otherwise. In addition it will change the WLAN LED status according to the wifi status.
For that, we will create the file
/sbin/woggle (for wifi toogle), that
#!/bin/sh case "$(uci get wireless.@wifi-device.disabled)" in 1) uci set wireless.@wifi-device.disabled=0 wifi echo 1 > /proc/diag/led/ses_white ;; *) uci set wireless.@wifi-device.disabled=1 wifi echo 0 > /proc/diag/led/ses_white echo 2 > /proc/diag/led/wlan ;; esac
The script first grabs the wifi status (
wireless.@wifi-device.disabled). If it deactivated (ie equal to
it actives it and switch on the LED of the SES button. Otherwise it deactivates
the wifi switch off the LED of SES button and let the WLAN LED blink once.
After creation do not forget to set it executable with the following command:
# chmod +x /sbin/woggle
To change the wifi status and test the command, you can run the script with the following command: