AR750 en-/disable tethering device via side-switch

Hello,
I have successfully modified the /usr/bin/switchaction script for activation/deactivation of the wlan.
The script function toggle_wifi_4g() also en-/disables the 3g/4g modem.
But sadly my 3g stick is only recognized as a tethering device.

Is it possible to en-/disable the tethering device in this script as well?

Hi, mkba
Please provide the firmware version number you are currently using,as well as the logread and dmesg information when you operate the modem and the switchaction script you modified?

Hello wellnw,

here are the files:
switchaction_logread_dmesg.zip (10.7 KB)

In the switchaction I have commented my modifications.

The logread and mesg outputs contain the cases:

  • disconnected and reconnected the tethering device
  • switch turns to disable and re-enable the wifi/modem

Thank you very much for your help.

Does anyone know if this possible?

Hi,mkba
disable tethering
uci set network.tethering.disabled='1'
uci commit network
/etc/init.d/network reload
enable tethering
uci set network.tethering.disabled='0'
uci commit network
/etc/init.d/network reload

Any way this code or alternative could be utilised for the Button Settings -
Button Left = Enable WAN & Disable Tethering
Button Right = Enable Tethering & Disable WAN

@wellnw
Thank you very much!! It works perfectly.

@exitguy
That was also what I was intenting to do. The Left/Right Button Settings are controled in the script /usr/bin/switchaction
In that script the function toggle_wifi_4g() controls WLAN/Modem/Tethering enabling/disabling.
Example:

if [ “$action” = “OFF” ];then
# If the switch is set to ‘OFF’ then everything is disabled
uci set wireless.default_radio0.disabled=‘1’
uci set wireless.default_radio1.disabled=‘1’
uci set network.modem_1_1_2.disabled=‘1’
uci set network.tethering.disabled=‘1’
action=ON
else
# If the switch is set to ‘ON’ then everything is enabled
# except for the 5Ghz wifi, 5Ghz wifi stays disabled
uci set wireless.default_radio0.disabled=‘1’
uci set wireless.default_radio1.disabled=‘0’
uci set network.modem_1_1_2.disabled=‘0’
uci set network.tethering.disabled=‘0’
action=OFF
fi

Also you have to replace the following lines

switch_enabled=$(uci get glconfig.switch_button.enable)
switch_func=$(uci get glconfig.switch_button.function)

with the following lines

switch_enabled=1
switch_func=“wifi&lte”

for the switch action to always invoke the function toggle_wifi_4g().

Here is my switchaction script I am using.
switchaction.zip (1.3 KB)

For control purpose here is my firmware version: OpenWrt 18.06.1 r7258-5eb055306f

@exitguy
Now I see you are talking about WAN not WLAN. Anyway, maybe the above will help anyone.