Skip to content

Instantly share code, notes, and snippets.

@lantis1008
Created June 15, 2015 04:59
Show Gist options
  • Save lantis1008/a12f084ae8baf51f08e9 to your computer and use it in GitHub Desktop.
Save lantis1008/a12f084ae8baf51f08e9 to your computer and use it in GitHub Desktop.
enables WiFi toggle on button press on a WNDR3800 running Attitude Adjustment
#!/bin/sh
#This script enables wifi toggle functionality on the Wifi button (BTN_2)
#of the WNDR3800 running Attiude Adjustment
(
cat << 'EOF'
#!/bin/sh
STATUS=`iwconfig wlan0 2>&1 | grep 'No such device'`
if [ -z "$STATUS" ]; then
wifi down
logger Wifi button pressed, wifi going down
else
wifi
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