I have EA8500 with the latest build kernel 4.14.53 OpenWrt SNAPSHOT r7410-d3a7587eb9 / LuCI Master (git-18.188.47906-e617902)
I did configure a guest network based on this link and it works great
After reading a little bit about how to use a button to turn wifi on and off I figured the the script /etc/rf.button/rfkill is executed to do this. This is already working and kills the whole wifi.
the script is:
#!/bin/sh
[ "${ACTION}" = "released" -o -n "${TYPE}" ] || exit 0
. /lib/functions.sh
rfkill_state=0
wifi_rfkill_set() {
uci set wireless.$1.disabled=$rfkill_state
}
wifi_rfkill_check() {
local disabled
config_get disabled $1 disabled
[ "$disabled" = "1" ] || rfkill_state=1
}
config_load wireless
case "${TYPE}" in
"switch")
[ "${ACTION}" = "released" ] && rfkill_state=1
;;
*)
config_foreach wifi_rfkill_check wifi-device
;;
esac
config_foreach wifi_rfkill_set wifi-device
uci commit wireless
wifi up
return 0
What do I have to change to the script so it only disables my guest instead of the whole wifi?
I figure it is something is this part of the script
wifi_rfkill_set() {
uci set wireless.$1.disabled=$rfkill_state
}
Sorry I'm not that good on shell scripting
******* I came up with this solution, but I'm sure there is a better way out there
#!/bin/sh
[ "${ACTION}" = "released" -o -n "${TYPE}" ] || exit 0
. /lib/functions.sh
SW=$(uci -q get wireless.@wifi-iface[2].disabled)
[ "$SW" == "1" ] && uci set wireless.@wifi-iface[2].disabled=0
[ "$SW" == "1" ] || uci set wireless.@wifi-iface[2].disabled=1
uci commit wireless
wifi up
return 0
Thanks