How can I make the side switch button turn Wifi on/off without using the GL-iNet interface on a GL-AR750s running OpenWrt?
Yes, but where do I put this script and how do I name it? I’ve never done anything like this so I’m having trouble conceptualizing it.
Switch button trigger script is /etc/rc.button/BTN_0. You can change it.
I don’t have a BTN_0 in /etc/rc.button/
It should exist. Isn’t it official firmware?
It’s the “official” OpenWrt version from openwrt.org, not GL-iNet’s OpenWrt version.
Then the file needs to be created.
You probably also want to detect the switch position before the network comes up, as described in the linked thread. Likely this would be just before
/etc/init.d/network, which executes with
START=20 Without this, it might be the case that the wireless comes on when the switch if off and/or vice-versa.
Should that be an empty file?
/etc/rc.button/BTN_0 would need to be a shell script that sets your wireless on or off, when the switch position changes.
/etc/init.d/wireless_switch (or the like) would need to be an “init script” that includes when it should run on boot and when on shutdown (probably doing nothing), along with what it needs to do in the
You would need a basic knowledge of shell scripts (POSIX sh, ash, or dash, as OpenWrt doesn’t support bash in its default configuration) to be able to write these. Using the
uci tool is perhaps the easiest way to control if a radio or AP is
disabled or not.