Accessing modem using libqmi

Hi,

I am looking for some working examples for accessing the Device Management Service (DMS) using libqmi, almost all google searches pointed towards towards qmicli code base, but the things are not straight forward, to start with I am looking for some kind of implementation which reading IMEI, RSSI etc… using the libqmi-glib module.

if anyone attempted this approach please shed some light

regards
KK

You could try to find some qmicli examples.

Request module manufacturer:
qmicli --device=/dev/cdc-wdm0 --device-open-proxy --dms-get-manufacturer

Get module model:
qmicli --device=/dev/cdc-wdm0 --device-open-proxy --dms-get-model

Get firmware version:
qmicli --device=/dev/cdc-wdm0 --device-open-proxy --dms-get-revision

Get module IDs (IMEI etc.):
qmicli --device=/dev/cdc-wdm0 --device-open-proxy --dms-get-ids

Get SIM card status:
qmicli --device=/dev/cdc-wdm0 --device-open-proxy --uim-get-card-status

Hi Wang,

I have used qmicli and it works perfectly fine, but my requirement is to fetch few modem parameters using my C application, so do we have some sample examples/documentation for calling sequence of the qmi api?

I have also notices, when i am running connection manager(quectel-CM) to open a data connection, the qmicli doesn’t work as it need the interface /dev/cdc-wdm0 to work, and its been used by quectel-CM, if that is the case I cant pole the modem parameters using qmi if the data connection is active, and the only way to do so is via ttyUSBx interface using AT commands, is that understanding correct?

regards
KK

There is C interface in the code of quectel-CM to get IMSI 、CCID.

quectel-CM would also use the /dev/cdc-wdm0.
If you would like to use libqmi and quectel-CM at the same time, I think you could run the qmi-proxy first.
And notice that run the qmi-proxy generated from the libqmi but not from the quectel-CM.

Can you help me with usage/documentation of qmi-proxy?

There was a similar ask in the other thread Quectel-qmi-proxy Usage - IoT Modules / LTE Standard Module - Quectel Forums

regards
KK

If you have the libqmi, you must find there is qmi-proxy.

$ find  /usr/ -name "*qmi-proxy*"
/usr/share/doc/libqmi-proxy
/usr/libexec/qmi-proxy


$ /usr/libexec/qmi-proxy --help
Usage:
  qmi-proxy [OPTION…] - Proxy for QMI devices

Help Options:
  -h, --help                 Show help options

Application Options:
  --no-exit                  Don't exit after being idle without clients
  --empty-timeout=[SECS]     If no clients, exit after this timeout. If set to 0, equivalent to --no-exit.
  -v, --verbose              Run action with verbose logs, including the debug ones
  --verbose-full             Run action with verbose logs, including the debug ones and personal info
  -V, --version              Print version

HI Wang,

I appreciate your reply, I got the --help information, my ask was how to use it after I open a proxy connection?

root@picv6-1:~# quectel-qmi-proxy --help
quectel-qmi-proxy: invalid option – ‘-’
[03-07_21:16:10:132] -d <device_name> A valid qmi device
default /dev/cdc-wdm0, but cdc-wdm0 may be invalid
-i <netcard_name> netcard name
-v Will show all details

After i run the proxy

root@picv6-1:~# quectel-qmi-proxy
[03-07_21:22:39:007] Will use cdc-wdm=‘/dev/cdc-wdm0’, proxy=‘quectel-qmi-proxy0’
[03-07_21:22:39:009] qmi_proxy_init enter
[03-07_21:22:39:010] qmi_proxy_loop enter thread_id 0xb6e6f460
[03-07_21:22:40:009] qmi_proxy_init succful
[03-07_21:22:40:010] local server: quectel-qmi-proxy0 sockfd = 4
[03-07_21:22:40:010] qmi_proxy_server_fd = 4

regards
KK