Uqmi: interface is up in OpenWrt, but datastatus is down

I have an LTE backup connection, managed by mwan3. The connection is meant to stay always online, which, unfortunately, isn't the case.

I'm on a ZTE MF287Pro with integrated Qualcomm Modem (but this also happened on older ZTE series, I don't have other devices to try). After quite some trial and error I figured the following out:

The "wwan" interface, managed by uqmi, is reported as up, yet data transfers don't work. I'm unsure about whether an IP address was shown or not, I shall check that next time it happens. Anyway, a call to uqmi -d /dev/cdc-wdm0 --get-data-status shows "disconnected".

For now, I have the following script run by cron every minute to "fix" it:

#!/bin/sh

. /usr/share/libubox/jshn.sh

json_load "$(devstatus wwan0)"
json_get_var status up

datastatus="$(uqmi -d /dev/cdc-wdm0 --get-data-status -t 500)"

if [ "$status" = "1" ] && [ "$datastatus" = '"disconnected"' ]; then
  echo "Interface up but datastatus is disconnected - forcing reconnect"
  logger -t wwan "Interface up but datastatus is disconnected - forcing reconnect"
  ifup wwan
else
  echo "All OK"
fi

Since I've never seen similar reports, are only ZTE devices affected?
Any advice on what would be the proper way to fix it?
I know there was some revamp going on, but this seems to have stalled.

Hi :slight_smile:

I've suspended my work on the topic and handed over the task to the much more knowledgeable lynxis.
Last month, he said he was investigating the use of a FSM (finite state machine) to reflect the state of the modem and considering using talloc for memory allocation.
I can assure you there has been progress since the PR.

In the meantime, I recommend using something to synchronize your calls to uqmi with those made by netifd to avoid deadlocks.
(maybe I can rebase my PR)

That looks quite common to me. I suggest using something like watchcat with re-connect or reset action in the script.

That's promising :slight_smile:

Well, the backup connection is metered and I don't want to cause any unnecessary traffic, even if it's just a ping. So far, the uqmi-command to --get-data-status has been working reliably.