Anyway to auto turn-off wifi when GL-E750 is teathered?

Hi there, I am using my GL-E750 as a fail-over at home and sometimes I grab it when I travel. Anyway to automatically disable GL-E750 wifi when it’s tethered to my router and when no longer tethered the wifi option is back on? I know it’s probably a simple script I can install maybe?

Thank you in advance!

I have coded a simple ipk, please install it with the following command:

wget http://download.gl-inet.com.s3.amazonaws.com/releases/v19.07.8/packages-3.0/ath79/glinet/gl-sdk4-carrier-monitor_git-2023.065.44692-e8e2ff2-1_mips_24kc.ipk
opkg install gl-sdk4-carrier-monitor_git-2023.065.44692-e8e2ff2-1_mips_24kc.ipk

I know it’s not perfect, but I hope it helps

root@GL-E750:~# cat /etc/hotplug.d/carrier/04-test 
#!/bin/sh

if [ "$INTERFACE" == "eth0" ];then
        if [ "$ACTION" == "up" ];then
                uci set wireless.default_radio0.disabled='1'
                uci set wireless.default_radio1.disabled='1'
                uci commit wireless
                wifi
        else
                uci set wireless.default_radio0.disabled='0'
                uci set wireless.default_radio1.disabled='0'
                uci commit wireless
                wifi
        fi
fi
2 Likes

Don’t make me come over there to slap exit 0 into that script. /s

That’s so awesome! Thank you so much for such quick reply, I am gonna test it tonight. Is there any way to easily disable/enable this? I don’t suppose I can add it to a toggle button :slight_smile: If that’s hard its no big deal I can always uninstall the package i assume. … and do i need this exit 0 thing? hahahah

Template to taste/to your needs:

#!/bin/sh

# 2023-07-25
# /etc/gl-switch.d/
# uci show wireless
# https://forum.gl-inet.com/t/feature-req-wifi-on-off-with-side-switch/2896/41

action=$1

if [ "$action" = "on" ]; then
        uci set wireless.default_radio0.disabled='0'
        uci set wireless.default_radio1.disabled='0'
        uci commit wireless
        wifi reload
        logger -p notice -t wifi-toggle "radios enabled"
fi

if [ "$action" = "off" ]; then
        uci set wireless.default_radio0.disabled='1'
        uci set wireless.default_radio1.disabled='1'
        uci commit wireless
        wifi reload
        logger -p notice -t wifi-toggle "radios disabled"
fi

# sleep 5

exit 0
1 Like

You guys are amazing hahaha, thank you for this, even going an extra step and adding a log event!

Welp @dengxinfa code works great, but the Action side button feature in @bring.fringe18 code doesn’t seem to be working. I tried removing it from vpn just in case…

…Maybe another option is to just have the code auto-detect if the port is in LAN mode (since then you don’t need wifi) or in WAN mode, in which case you would need it.

Thank you again guys! This already works great

It could be a difference in the device & its firmware. /etc/gl-switch.d/ is present in 4.2.3-release5 (Slate AX ATX1800). If you have files in that dir it should execute.

I have GL-E750, and don’t have that folder, unfortunately. I got these:

Damn; we might have to bother @dengxinfa for a bit of insight here given the differences. It’d be interesting to see if his posted hotplug.d script could be adapted.

Try this:

cat >> /etc/rc.button/BTN_0 << EOF
if [ "\$ACTION" == "pressed" ];then
	uci set glconfig.general.my_button_setting="1"
	uci commit glconfig
else
	uci set glconfig.general.my_button_setting="0"
	uci commit glconfig
fi
EOF

sed -i '/2/a [ "$(uci -q get glconfig.general.my_button_setting)" != "1" ] && exit' /etc/hotplug.d/carrier/04-test  

2 Likes

Had to turn off the toggle setting in the admin and then it started working. Thank you!
One last thing, I tried adding

“echo ‘{ “msg”: “Wifi disable on eth - enabled” }’ >/dev/ttyS0”
So I can see a message on an OLED screen when I toggle the switch, but it just displays the last toggle setting like “Turning on WG” etc. Any reason it’s not working?