Hi,
On my WNDR4300v1, with the 1.8.1 version of Gargoyle, the Wifi button worked fine even if I didn't do anything for it : I supposed the scripts were already in the downloaded firmware.
I put yesterday the 1.9.2 version and the Wifi button didn't worked anymore.
Therefore, I set it up with as a basis the explanations of Lantis in this topic.
The name of the Wifi button on WNDR4300v1 is 'rfkill'.
You can use the following script to set it up (based on the last script from Lantis) :
Code: Select all
#!/bin/sh
#This script enables wifi toggle functionality on the Wifi button (rfkill)
#of the WNDR4300v1 running Chaos Calmer Gargoyle
(
cat << 'EOF'
#!/bin/sh
STATUS=`iwinfo`
if [ -n "$STATUS" ]; then
wifi down
logger Wifi button pressed, wifi going down
else
wifi up
logger Wifi button pressed, wifi going up
fi
EOF
) > /etc/wifitoggle.sh
chmod +x /etc/wifitoggle.sh
ln -s /etc/rc.button/gargoyle_button_handler /etc/rc.button/rfkill
uci set system.wifi_toggle=button
uci set system.wifi_toggle.button=rfkill
uci set system.wifi_toggle.action=pressed
uci set system.wifi_toggle.handler=/etc/wifitoggle.sh
uci commit system
To use this script, you have to create a file on the router, in various ways :
- either in WinSCP (1), in \tmp, right click and choose New -> File (or Shift-F4), rename it install.sh, edit it and copy into it the code above ;
- either in PuTTY (2), with the method described by Lantis at the beginning of this topic, ie type
then copy into it the code above (with WinSCP).
- either copy the code above directly in a text file named install.sh on your computer (3), and transfer it after with WinSCP on the router, in the /tmp directory.
After all, you should perhaps change the executable properties of the file :
- in PuTTY, with chmod +x install.sh
- or in WinSCP, with right click on the file and Properties (or F9)
Be careful, if you choose the (3) method and have like me a Windows OS (I've used Notepad++ to create/modify the file), after you have transferred install.sh with WinSCP, you must edit then save the file by double-clicking it in WinSCP, in my case the .sh file wasn't recognized by the shell and not executed.
- the error was :
line xx: syntax error: unexpected "fi" (expecting "then" - if someone has an explanation... I'm not a pro of Unix/Linux shell scripts.
To execute this script, in PuTTY type
If you want to check, type
uci show system
Now the Wifi button should be functional.
Frederic