[LEDE-DEV] uqmi: re-enable autoconnect which was dropped without explanation

Petr Štetiar ynezz at true.cz
Fri Oct 21 02:06:03 PDT 2016


Felix Fietkau <nbd at nbd.name> [2016-10-20 12:09:36]:

> On 2016-10-19 23:49, Petr Štetiar wrote:
> > 
> > How to fix it for both use cases, with and without autoconnect feature?
> > Introduce qmi_autoconnect config option?
>
> I think we probably need to introduce such an option as a temporary
> measure.

Ok, I'll do this. Is this variable name fine?

> The problem with not using autoconnect is that once the link is gone for a
> while, the link will be torn down and not re-established anymore. To deal
> with that properly, we need some code to monitor the link and try to
> re-establish the connection when it's gone.

Even when enabled and usable, this autoconnect feature is as reliable as the
modem firmware is.  I'm seeing a lot of problems with such modems(freezing,
unable to connect) and I generally do not trust them so I use some additional
checking via my custom wan-connection-keeper daemon/script which runs following
check in periodic intervals:

	check_connection() {
		local wan_iface=$(uci -q get wan-connection-keeper.core.wan_interface)
		local check_timeout=$(uci -q get wan-connection-keeper.core.check_timeout)
		local uci_check_url=$(uci -q get wan-connection-keeper.core.uci_check_url)
		local url=$(uci -q get $uci_check_url)

		[ -z "$url" ] && {
			log_dbg "ERROR, check URL is empty"
			return 1
		}

		[ -z "$wan_iface" ] && {
			log_dbg "ERROR, WAN interface is empty"
			return 1
		}

		[ -z $check_timeout ] && check_timeout=5

		log_dbg "Checking URL: $url timeout: $check_timeout"
		curl -s -m$check_timeout -H "User-Agent: $NAME v$VERSION" $url> /dev/null && {
			log_dbg "Connection check OK!"
			return 1
		}

		log_dbg "ERROR, connection failed, restarting $wan_iface"

		echo oneshot > /sys/class/leds/reset-usb-hub2/trigger
		echo none > /sys/class/leds/reset-usb-hub2/trigger

		ifdown $wan_iface
		ubus call network.interface.$wan_iface remove
		pkill -9 uqmi
		sleep 5
		ifup $wan_iface

		/etc/init.d/ugps restart # TODO: move somewhere else
	     
		return 0
	}

How to make it more generic as you propose. Move it inside netifd?

	config interface 'wan'
		option connection_check '/path/to/checkscript'
		option connection_check_interval 60

-- ynezz



More information about the Lede-dev mailing list