question about qmicli

Aleksander Morgado aleksander at aleksander.es
Fri Oct 23 07:34:28 UTC 2020


Hey,

> I'm writing some questions to Aleksander in the web page https://sigquit.wordpress.com/2012/08/20/an-introduction-to-libqmi/
>
>  i have a problem executing one especific qmi commnad inside a python script with the call
> content = subprocess.run("sudo qmicli -p -d /dev/cdc-wdm0 --wds-get-packet-statistics  --device-open-sync | awk '/TX packets dropped:/,/RX packets dropped:/'", check=True, shell=True,stdout=subprocess.PIPE)
>
> I've probe without -p and without --device-open-sync  but the problem is the same
> always receive as response : error: couldn't get packet statistics: QMI protocol error (15): 'OutOfCall'
>
> aleksander anser that the modem must be connected to receive response, but the modem is connected
> with ip, sending pings to google and sending http posts to another site

The fact that you're running a command with --device-open-sync may end
up disconnecting the device, because that cleans up all allocated QMI
clients. Don't do that, don't run with --device-open-sync.

Also, you need to run --wds-get-packet-statistics on the specific WDS
client that got the modem connected i.e. When you run WDS Start
Network on a WDS client, that client is the one that keeps the
connection up, and that client is the one that will give you the
packet statistics for the specific connection that was brought up.
E.g. in ModemManager we use a WDS client for IPv4 and another WDS
client for IPv6, and we can get packet statistics for both separately.

>
> but the real problem is after some minutes the response is
> [22 Oct 2020, 17:16:40] -Error ** __qmi_message_ctl_sync_response_parse: assertion 'qmi_message_get_message_id (message) == QMI_MESSAGE_CTL_SYNC' failed
>
> (qmicli:8618): GLib-GIO-CRITICAL **: 17:16:40.933: g_task_return_error: assertion 'error != NULL' failed
>
> the command is inside a try exception block but this block the execution of next qmicli commands, and really clock the connection of the modem (cell comm)
> the module user is a SIMCOM SIM7600G-H
>

That issue was fixed in this commit:
https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/commit/69354f53f180b32c8f183a1217582e557b791220

I believe what you're seeing is due to using --device-open-sync. If
you use that option, you should use it exclusively on the first
command you send to the module, and only if your program is the only
one using the module, otherwise you're breaking the flow for every
other program as well. My suggestion is to completely ignore that
option, not even sure why you started to use it :)

> if i execute the same qmi command in the command line every one of then intents i get the result expected. in other terminal i run a ping to google to verify the connection
>
> how to prevent this problem? i need the params rx_dropped and tx_dropped given by this command.
>

As said before, you should run the command on the WDS client that
brought up the connection with Start Network.

> another problem is for example in the execution of this qmicli command
> contenido = subprocess.run("sudo qmicli -p -d /dev/cdc-wdm0 --nas-get-signal-strength --device-open-sync | awk '/RSSI:/,/SINR/'", check=True, shell=True,stdout=subprocess.PIPE)
>
> the result is always:
> qmicli: symbol lookup error: qmicli: undefined symbol: qmi_message_nas_get_signal_info_output_get_tdma_signal_strength_extended
>
> this not make any problem with the awk filter and i can get the parameters rssi and Ecio, but how can i get no error in the execution?
>

This is because you're running your custom compiled qmicli but using
an older libqmi-glib library. If I had to bet, you built libqmi
yourself without using a custom --prefix in configure, and so you
installed qmicli in /usr/local/bin and libqmi-glib in /usr/local/lib,
but when you run "qmicli" the PATH looks first in /usr/local so you're
running qmicli from your newly built instance but linking to
libqmi-glib in /usr/lib (probably the system-installed one).  I
believe it's Debian/Ubuntu the ones that have /usr/local/bin in the
PATH by default and that creates a big mess. I'm assuming all this,
but if it is true and you did build your own libqmi without using
--prefix in configure, try to run qmicli like this instead:

$ LD_LIBRARY_PATH=/usr/local/lib qmicli -p -d /dev/cdc-wdm0
--nas-get-signal-strength ....

Or, otherwise, install libqmi "on top" of the system-installed one
with --prefix=/usr or whatever your system uses.

-- 
Aleksander
https://aleksander.es


More information about the libqmi-devel mailing list