Concurrent qmicli request
Aleksander Morgado
aleksander at aleksander.es
Wed Nov 28 09:00:22 UTC 2018
Hey,
>
> Is there a way to get multiple information request at the same time ?
>
> --nas-get-signal-strength,
> --dms-get-time,
> ...
>
If you mean a single qmicli command to run multiple operations like
those before, no, that is not possible. The qmicli command tries to
mimic the QMI requests, so one command per request.
> I tried using --client-cid but every single id I tried was marked as invalid.
>
> The aim is to pull information from a usb modem in the form of a data logger with a refresh rate in the subseconds. If I try to get 3-4 concurrent "watch" on a qmicli service I exhaust my cid's.
> "sudo watch -p -n 1 /usr/bin/qmicli -d /dev/cdc-wdm0 -v --nas-get-signal-strength"
>
> Does anyone of you have any suggestion or trick to overcome the cid exhaustion or ways to use libqmi-glib?
>
You need to allocate the per-service CID once, and re-use it over and
over in all your queries after that, that is probably the easiest way.
So first, for example, you allocate a QMI client for the NAS service.
You can do this either the first time you run a real request command,
or using the --nas-noop option, and then you reuse that same CID in
all your next commands. A quick example:
NAS_NOOP_OUT=$(qmicli -d /dev/cdc-wdm0 --nas-noop --client-no-release-cid)
CID=`echo "$NAS_NOOP_OUT" | sed -n "s/.*CID.*'\(.*\)'.*/\1/p"`
if [ -z "$CID" ]; then
echo "error: not allocated"
else
while [ 1 ]; do
qmicli -d /dev/cdc-wdm0 --nas-get-signal-strength
--client-no-release-cid --client-cid=${CID}
sleep 1
fi
If you need DMS operations as well you would also allocate a DMS CID
in the same way.
And once you don't need the NAS CID any more, e.g. before exiting your
program or whatever, you do the explicit client release by running the
--nas-noop operation WITHOUT --client-no-release-cid:
qmicli -d /dev/cdc-wdm0 --nas-noop --client-cid=${CID}
A good example of qmicli usage is the qmi-network program, see:
https://gitlab.freedesktop.org/mobile-broadband/libqmi/blob/master/utils/qmi-network.in
And if you want to use libqmi-glib directly in a C program, qmicli
itself is a good example of usage:
https://gitlab.freedesktop.org/mobile-broadband/libqmi/tree/master/src/qmicli
--
Aleksander
https://aleksander.es
More information about the libqmi-devel
mailing list