Can't figure out how to run this script below by pushing wps button on BT hub5A to toggle the radio0 on/off. I replaced /etc/rc.button/wps with this excutable script.
#!/bin/sh
{
SW="$(uci -q get wireless.default_radio0.disabled)"
[ "${SW}" = "1" ] \
&& uci del wireless.default_radio0.disabled \
|| uci set wireless.default_radio0.disabled='1'
wifi
}
It will turn on the default_radio0, but when I press it again it won't turn it off. If i run the script from ssh it will toggle it on and off as I would expect it to work .
If I replace wps and reboot with the 2 scripts below then I can press one button to turn default_radio0 on and other button to turn it off.
#!/bin/sh
{
uci set wireless.default_radio0.disabled=0; uci commit wireless; wifi reload
}
return 0
#!/bin/sh
{
uci set wireless.default_radio1.disabled=0; uci commit wireless; wifi reload
}
return 0
Tried various combinations with/without return 0, disabled='0', disabled="0", with/without uci commit wireless and wifi reload but no joy.
Tried hotplug and then triggerhappy as suggested in https://openwrt.org/docs/guide-user/hardware/hardware.button#procdbuttons but couldn't get them to work.
Is it just a syntax mistake or the way the device runs a script from button push?