IND.T Classification: Public

Thanks Filip for your help.  I think I have enough info to retrieve the 
information.  I will git it a try.

Yes, it is to be parsed by a program/script.

The ModemManager I am currently using is quite old (v1.10 from Debian 10 
Buster) so json (-J) output is practically non-existent.  I either parse the 
raw human text output or use the -K option and parse.

Thanks, Brendan.

From: Filip Kubicz <filip.kub...@tier.app>
Sent: Monday, April 24, 2023 9:01 PM
To: Brendan Simon <brendan.si...@ind-technology.com.au>
Cc: modemmanager-devel@lists.freedesktop.org
Subject: Re: Get modem SIM properties for mmcli


This email originated from EXTERNAL
I assumed you need to parse it for a program, but if you just need a 
human-readable version, you can also use
mmcli -i 0
For a quick overview, and to filter it, grep for the line that you are 
interested in.

Kind regards,
Filip


On Mon, Apr 24, 2023 at 12:58 PM Filip Kubicz 
<filip.kub...@tier.app<mailto:filip.kub...@tier.app>> wrote:
Hi Brendan,

There are a few approaches but a convenient method to retrieve values from 
mmcli is to use -J flag to get the JSON output.

For example, to get modem IMEI, you can do (in bash):
        modem="$(mmcli --list-modems -J | jq '."modem-list"[0]' -r)"
        imei="$(mmcli -m ${modem} -J | jq '.modem."3gpp".imei' -r)"
        echo ${imei}

You should be able to do the same with SIM card information, which you can 
obtain by running
        mmcli -i 0 -J
and then parsing it with jq tool to obtain exactly the value you need. Note 
that the SIM may be available under different number/path, which you can get 
from mmcli -m <modem number> and parsing "primary sim path"

Kind regards,
Filip


On Mon, Apr 24, 2023 at 12:34 PM Brendan Simon 
<brendan.si...@ind-technology.com.au<mailto:brendan.si...@ind-technology.com.au>>
 wrote:

IND.T Classification: Public

Is there a way to get the modem SIM properties via the mmcli command?
e.g. the ICCID or SimIdentifier
org.freedesktop.ModemManager1.Sim: ModemManager Reference Manual 
(www.freedesktop.org)<https://www.freedesktop.org/software/ModemManager/doc/latest/ModemManager/gdbus-org.freedesktop.ModemManager1.Sim.html#gdbus-property-org-freedesktop-ModemManager1-Sim.SimIdentifier>

I couldn’t find anything in the help.

These docs mention the methods (such as sendpin, sendpuk, enablepin, changepin, 
setpreferrednetworks), which are available via mmcli.

It also mentions various properties (such as Active, SimIdentifier, IMSI, …), 
but I can’t find a way to retrieving those via mmcli (except maybe via issue AT 
commands).

org.freedesktop.ModemManager1.Sim: ModemManager Reference Manual 
(www.freedesktop.org)<https://www.freedesktop.org/software/ModemManager/doc/latest/ModemManager/gdbus-org.freedesktop.ModemManager1.Sim.html>

Are these properties easily obtainable via mmcli?  I would think they should 
be, but I can’t find out how.

Thanks,
Brendan.

Reply via email to