wda-get-data-format randomly returns error: couldn't create client for the 'wda' service

Tor Rune Skoglund trs at fourc.eu
Wed Apr 8 12:28:45 UTC 2020


Thanks Aleksander,

tir. 7. apr. 2020 kl. 17:17 skrev Aleksander Morgado <
aleksander at aleksander.es>:

> > I have some further updates here. I read another thread about the '-p'
> option,
> > which, when added to all instances of qmicli invocation in the init.d
> file makes
> > the problem go away in at least more than 9 out of 10 cases. So it is
> > apparently a timing issue. Still have to test this on more than one
> > system, but I am optimistic. :)
>
> The "-p" option, if used, must be used in ALL qmicli commands, so that
> all use the intermediate qmi-proxy.
> I wonder what init.d file you're talking about, though?
>

We initialise the modem with this routine (somewhat simplified to
illustrate the points):

START_NETWORK_ARGS=apn="internet",ip-type=4,autoconnect=yes

#QMICMD='qmicli -p '
QMICMD='qmicli '

for DEV in $(find /dev -maxdepth 1 -name "cdc-wdm*" | sort)
do
    WANIF=$($QMICMD -d "$DEV" -w)
    if $QMICMD -d "$DEV" --wds-get-packet-service-status | grep -q
status:..connected ; then
        echo "Stopping as it was already connected $DEV $WANIF"
        $QMICMD -d "$DEV" --wds-stop-network=disable-autoconnect
        ip link set "$WANIF" down 2>&1
        ip addr flush dev "$WANIF" 2>&1
        echo "Stopped broadband on $DEV $WANIF to restart connection"
    fi

    # Does it work at all....?
    if ! $QMICMD -d "$DEV" --wda-get-data-format ; then
        echo "Modem does not respond as expected - trying to reset it"
        # Here we had some code to try various things to get it working,
like resetting the usb port it is connected to.
        # However, following commands could still fail
    fi

    # Change to 802-3
    if $QMICMD -d "$DEV" --wda-get-data-format | grep -q 'raw-ip'; then
        echo "Identified $DEV $WANIF as raw-ip, changing to 802-3"
        if ! $QMICMD -d "$DEV" --wda-set-data-format=802-3 ; then
            echo "wda-set-data-format=802-3 failed"
            exit 1
        fi
    else
        echo "Failed to set $DEV $WANIF data format to 802-3"
    fi

    # Set up if correct mode
    if ! $QMICMD -d "$DEV" --wda-get-data-format | grep -q '802-3'; then
        echo "Modem is not is correct data format mode"
        exit 1
    fi
    echo "Starting broadband on $DEV $WANIF with args
'$START_NETWORK_ARGS'"
    $QMICMD -d "$DEV"
--wds-start-network=${START_NETWORK_ARGS:-apn=\"internet\"}
--client-no-release-cid
    $QMICMD -d "$DEV"
--wds-set-autoconnect-settings=enabled,roaming-allowed
    echo "Started broadband on $DEV $WANIF"
    killall -HUP dhcpcd
    exit 0 # Done
done

einfo "Failed to set up broadband adapter"
exit 1 # Failed

If I use -p it seems to work close to 100% (maybe 100% of the times).
Without the script fails too often on the first wda-get-data-format.

(Btw, --wds-start-network also gives an error, but it does not seem to
affect anything:
qmicli -p -d /dev/cdc-wdm0
--wds-start-network=apn=internet,ip-type=4,autoconnect=yes
--client-no-release-cid
error: couldn't start network: QMI protocol error (14): 'CallFailed'
call end reason (3): generic-no-service
verbose call end reason (2,210): [internal] pdn-ipv6-call-disallowed
[/dev/cdc-wdm0] Client ID not released:
       Service: 'wds'
           CID: '9')

Actually, while writing this mail, I made a new discovery: It looks like
if  -wda-get-data-format fails once, for example when running it first
without -p, it will keep on failing, even if run with -p later. However, a
usb port reset (unbind/bind) will make it work again if I then run with -p
directly afterwards.

I have very few clues on what is going on. It could very well be that we
are doing something wrong....(?)
  <https://aleksander.es>
BR,
Tor Rune Skoglund
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libqmi-devel/attachments/20200408/274888b8/attachment.htm>


More information about the libqmi-devel mailing list