RA150 slider configuration to disable WWAN

I want the routers slider to turn on and off the wwan port but I couldn’t set /etc/rc.button/BTN_8 code correctly.

First detect the switch location, then do something.
This script only works when you move the switch, not when router power up. So you’d better put the script in /etc/init.d/initswitch (firmware 2.x) or /usr/bin/switchaction (firmware 3.x)
You will find there are a lot of script already. So you may need to modify instead of write something yourself.

The ideas are:

switch_left=$(grep -o "BTN_8.*hi" /sys/kernel/debug/gpio)

if [ -n "$switch_left" ]; then
    #this is the left side, let's use repeater. If we renamed gl_health, name it back 
    mv /usr/bin/gl_health1 /usr/bin/gl_health
    /usr/bin/gl_health &
    uci set wireless.sta.disabled=0
    uci commit wireless
    wifi  #if in startup script, remove this line
else
    #this is the right side, let's disable repeater and repeater manager. We also rename gl_health so that it will not called up by the UI or other scripts
    killall /usr/bin/gl_health
    mv /usr/bin/gl_health /usr/bin/gl_health1
    uci set wireless.sta.disabled=1
    uci commit wireless
    wifi #if in startup script, remove this line
fi
1 Like

Thanks, this worked (almost). It doesn’t reconnect to the wwan provider when the connection is re-enabled.
If I turn autoconnect on in the GUI it connects even when the wwan should be disabled.

If I knew the codeline which enables/disables autoconnect, or the one that connects manually to a host, I could make it work.

The reconnect process is gl_health, that’s because the process has been renamed when you disable it.