Hi,
Script based on http://wiki.openwrt.org/OpenWrtDocs/Cus … WifiToggle and http://wiki.openwrt.org/OpenWrtDocs/Kam … itoggle%29
/etc/hotplug.d/button/01-wifitoggle
. /lib/config/uci.sh
. /etc/functions.sh
config_load "wifitoggle"
local section="cfg1"
config_get "BUTTON_NAME" "$section" "button"
toggle_radio() {
local section="$1"
config_get "WIFI_RADIOSTATUS" "$section" "disabled"
case "$WIFI_RADIOSTATUS" in
0|"")
uci_set "wireless" "$section" "disabled" "1"
uci_commit "wireless"
wifi
if [ "$BUTTON_NAME" = "ses" ] ; then
echo 0 > /proc/diag/led/ses_white
fi
;;
1)
uci_set "wireless" "$section" "disabled" "0"
uci_commit "wireless"
wifi
if [ "$BUTTON_NAME" = "ses" ] ; then
echo 1 > /proc/diag/led/ses_white
fi
;;
esac
}
if [ "$BUTTON" = "$BUTTON_NAME" ] && [ $SEEN != "0" ] ; then
if [ "$ACTION" = "pressed" ] ; then
config_load "wireless"
config_foreach toggle_radio wifi-device
fi
fi
/etc/config/wifitoggle
config wifitoggle
option button 'ses'
Bye