Hello,
There is no way direct way to achieve what you desire, however, there are a couple of couple of suggestions below, involving CLI/SSH manipulation:
- Modify hotplug script:
- Login to the router via SSH;
- Go to the following directory:
- edit 89-gsm-event script with a text editor:
- append the following lines:
if [ "$MODEM" != "" ]; then
identify_modem "$MODEM"
if [ "$ACTION" = "ifup" ] || [ "$iface" -gt 0 ]; then
mdm_ubus_obj="$(find_mdm_ubus_obj "$MODEM")"
get_operator
get_contype
log "Mobile Data" "Mobile data connected ($MODEM_TYPE modem)"
log "Network Type" "Joined $CONTYPE network ($MODEM_TYPE modem)"
log "Network Operator" "Connected to $OPERATOR operator ($MODEM_TYPE modem)"
ubus call ioman.gpio.dio0 update '{"value":"0"}'
logger "DOUT off"
elif [ "$ACTION" = "ifdown" ]; then
log "Mobile Data" "Mobile data disconnected ($MODEM_TYPE modem)"
ubus call ioman.gpio.dio0 update '{"value":"1"}'
logger "DOUT on"
fi
The above will change the state of the output on each mobile interface state change from/to up/down. Logger lines are simply for an indication that the added command was executed.
- Add custom script:
- Login to router's WebUI;
- Navigate to System -> Custom scripts;
- Add a similar script:
#!/bin/ash
sleep 45
while [ 1 ]; do
sleep 5
ping -I wwan0 8.8.8.8 -s 0 -c 3 -q >/dev/null
ret=$?
if [ $ret -ne 0 ]; then
ubus call ioman.gpio.dio0 update '{"value":"1"}'
logger "Mobile disconnected"
else
ubus call ioman.gpio.dio0 update '{"value":"0"}'
logger "Mobile connected"
fi
done
The above script checks mobile connection health by periodically sending ping requests to 8.8.8.8 and, if no ping reply is received, it is considered that interface is disconnected and output state is changed.
Best regards,