we can get you both up and running if you are willing to do some very basic coding.
You will need:
PuTTY.exe (or your favourite SSH client)
WinSCP
log into your router with both of these programs, defaults are:
hostname: 192.168.1.1
port: 22
username: root
password: yourpassword
in WinSCP make sure you set File Protocol to SCP, and also tell it to remember your password for the session or you will be typing it over and over.
in WinSCP navigate to "/etc/hotplug.d/button"
and open "00-button" for editing.
add the following line as shown:
Code: Select all
logger the button was $BUTTON and the action was $ACTION
Code: Select all
[ "$ACTION" = "$action" -a "$BUTTON" = "$button" -a -n "$handler" ] && {
[ -z "$min" -o -z "$max" ] && eval $handler
[ -n "$min" -a -n "$max" ] && {
[ $min -le $SEEN -a $max -ge $SEEN ] && eval $handler
}
}
logger the button was $BUTTON and the action was $ACTION
}
i.e. make sure it goes between the 2nd last and last braces.
Save and close, wait until the changes have uploaded.
go and press the button on your router that you wish to have as your wifi toggle button.
in PuTTY, type "logread".
look for the following phrase
"user.notice.root: the button was XXX and the action was pressed/released"
write this button name down exactly as stated, we will need it soon. for the fellow with the WNDR3800 it should be BTN_2.
now in PuTTY type
cd /etc
touch wifitoggle.sh
chmod +x wifitoggle.sh
using WinSCP, find the file "wifitoggle.sh" in /etc and put the following into it
Code: Select all
#!/bin/sh
STATUS=`wifi status | grep -m 1 up | sed -e 's/^[ \t]*//' -e 's/"up": //'`
if [ "$STATUS" == "true," ]; then
wifi down
logger Wifi button pressed, wifi going down
else
wifi up
logger Wifi button pressed, wifi going up
fi
now back to PuTTY (i promise we are almost done) issue the following commands
uci set system.wifi_toggle=button
uci set system.wifi_toggle.button=BTN_2 <-- or whatever the name of the button was we found earlier
uci set system.wifi_toggle.action=pressed
uci set system.wifi_toggle.handler=/etc/wifitoggle.sh
uci commit system
test it out and see what happens.