Skip to content

Instantly share code, notes, and snippets.

@lantis1008
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lantis1008/408f6a64ce16962bc28d to your computer and use it in GitHub Desktop.
Save lantis1008/408f6a64ce16962bc28d to your computer and use it in GitHub Desktop.
enables WiFi toggle on button press on a WNDR3800 running Barrier Breaker
#!/bin/sh
#This script enables wifi toggle functionality on the Wifi button (BTN_2)
#of the WNDR3800 running Barrier Breaker
(
cat << 'EOF'
#!/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
EOF
) > /etc/wifitoggle.sh
chmod +x /etc/wifitoggle.sh
uci set system.wifi_toggle=button
uci set system.wifi_toggle.button=BTN_2
uci set system.wifi_toggle.action=pressed
uci set system.wifi_toggle.handler=/etc/wifitoggle.sh
uci commit system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment