mmcli(1) | User Commands | mmcli(1) |
mmcli - Control and monitor the ModemManager
mmcli [OPTION...]
ModemManager is a DBus-powered Linux daemon which provides a unified high level API for communicating with (mobile broadband) modems. It acts as a standard RIL (Radio Interface Layer) and may be used by different connection managers, like NetworkManager. Thanks to the built-in plugin architecture, ModemManager talks to very different kinds of modems with very different kinds of ports. In addition to the standard AT serial ports, Qualcomm-based QCDM and QMI ports are also supported.
The default mode is ERR.
This command will not exit right away, as that would implicitly remove the inhibition. The user must make sure to stop the mmcli process hitting Ctrl+C in order to un-inhibit the device.
When a device is inhibited via this method, ModemManager will disable the modem (therefore stopping any ongoing connection) and will no longer use it until it is uninhibited.
The supported KEYs are:
This command will not exit right away. The user must make sure to stop the mmcli process hitting Ctrl+C in order to stopping monitoring for new events.
All options below take a PATH or INDEX argument. If no action is provided, the default information about the modem, bearer, etc. is shown instead.
The PATH and INDEX are created automatically when the modem is plugged in. They can be found using mmcli -L. This produces something like (for modems only):
In this case, the INDEX is 4 and the PATH is the entire string above.
However, for the bearers, SIMs and SMS cases, the PATH is slightly different. The Modem is replaced with the object name in use, like Bearer. For example:
All of the modem options below make use of the --modem or -m switch to specify the modem to act on.
Some operations require a MODE. MODE can be any combination of the modes actually supported by the modem. In the perfect case, the following are possible:
'2G' - 2G technologies, e.g. EDGE, CDMA1x
'3G' - 3G technologies, e.g. HSPA, EV-DO
'4G' - 4G technologies, e.g. LTE
'ANY' - for all supported modes.
This powers the antenna, starts the automatic registration process and in general prepares the modem to be connected.
This disconnects the existing connection(s) for the modem and puts it into a low power mode.
The CODE provided is vendor specific. Without the correct vendor code, it's unlikely this operation will succeed. This is not a common user action.
An example would be: 'egsm|dcs|pcs|g850' to select all the GSM frequency bands.
This command will not exit right away, as that would implicitly remove the inhibition. The user must make sure to stop the mmcli process hitting Ctrl+C in order to un-inhibit the device.
When a device is inhibited via this method, ModemManager will disable the modem (therefore stopping any ongoing connection) and will no longer use it until it is uninhibited.
The 3rd Generation Partnership Project (3GPP) is a collaboration between groups of telecommunications associations. These options pertain to devices which support 3GPP.
Included are options to control USSD (Unstructured Supplementary Service Data) sessions.
All of the 3GPP options below make use of the --modem or -m switch to specify the modem to act on.
This registers with the default network(s) specified by the modem,
For example, COMMAND could be '*101#' to give your current pre-pay balance.
All CDMA (Code Division Multiple Access) options require the --modem or -m option.
All simple options must be used with --modem or -m.
These options detail how to discover your location using Global Positioning System (GPS) or directly from your mobile network infrastructure (either 3GPP or 3GPP2).
All location options must be used with --modem or -m.
This command will start the GPS engine, if it isn't started already.
If the raw output is not enabled at the same time, the GPS engine will be stopped.
This command will start the GPS engine, if it isn't started already.
If the NMEA output is not enabled at the same time, the GPS engine will be stopped.
This DBus property signal updates are by default disabled.
All messaging options must be used with --modem or -m.
All time operations require the --modem or -m option.
All voice operations require the --modem or -m option.
All firmware options require the --modem or -m option.
The ID provided is a UNIQUE identifier for the firmware.
All signal options require the --modem or -m option.
By default this is disabled (rate set to 0).
All OMA options require the --modem or -m option.
The given session type must be one of:
'client-initiated-device-configure'
'client-initiated-prl-update'
'client-initiated-hands-free-activation'
All bearer options require the --bearer or -b option.
All SMS options require the --sms or -s option.
You'll need first to know which the proper path/index is for the
SIM in your modem:
$ mmcli -m 0 -K | grep "modem.generic.sim" | awk -F ": "
'{ print $2 }'
/org/freedesktop/ModemManager1/SIM/0
And after that, you can just use the SIM index:
$ sudo mmcli -i 0 --pin=1234
successfully sent PIN code to the SIM
You can launch the simple connection process like:
$ sudo mmcli -m 0 --simple-connect="pin=1234,apn=internet"
successfully connected the modem
Then, you can disconnect it like:
$ sudo mmcli -m 0 --simple-disconnect
successfully disconnected all bearers in the modem
Scanning for 3GPP networks may really take a long time, so a
specific timeout must be given:
$ sudo mmcli -m 0 --3gpp-scan --timeout=300
---------------------
3GPP scan | networks: 21403 - Orange SP (gprs, unknown)
| 21407 - Movistar (gprs, unknown)
| 21404 - YOIGO (gprs, unknown)
| 21401 - vodafone ES (gprs, unknown)
Using the “sm” (SIM), you can do this using:
$ sudo mmcli -m 0 --messaging-create-sms="text='Hello
world',number='+1234567890'"
Successfully created new SMS:
/org/freedesktop/ModemManager1/SMS/21 (unknown)
$ sudo mmcli -s 21 --store-in-storage="sm"
successfully stored the SMS
$ sudo mmcli -s 21
-------------------------------
General | dbus path: /org/freedesktop/ModemManager1/SMS/21
-------------------------------
Content | number: +1234567890
| text: Hello world
-------------------------------
Properties | PDU type: submit
| state: stored
| smsc: unknown
| validity: 0
| class: 0
| storage: sm
| delivery report: not requested
| message reference: 0
$ sudo mmcli -m 0 --messaging-status
----------------------------
Messaging | supported storages: sm, me
| default storage: me
As you can see below, the important part is the --messaging-create-sms-with-data and the PATH provided.
$ sudo mmcli -m 0 \
--messaging-create-sms="number='+1234567890'" \
--messaging-create-sms-with-data=/path/to/your/file
Successfully created new SMS:
/org/freedesktop/ModemManager1/SMS/22 (unknown)
$ sudo mmcli -s 22 --send
successfully sent the SMS
When the receiver gets all the parts of the message, they can now recover the sent file with another mmcli command in their ModemManager setup:
$> sudo mmcli -m 0 --messaging-list-sms
/org/freedesktop/ModemManager1/SMS/0 (received)
$> sudo mmcli -s 0 --create-file-with-data=/path/to/the/output/file
You first need to check whether the modem has GPS-specific location capabilities. Note that we’ll assume the modem is exposed as index 0; if you have more than one modem, just use --list-modems to check the proper modem index:
$ mmcli -m 0 --location-status
----------------------------
Location | capabilities: 3gpp-lac-ci, gps-raw, gps-nmea
| enabled: none
| signals: no
The output says that the modem supports 3GPP Location area code/Cell ID, GPS raw and GPS-NMEA location sources. None is enabled yet, as we didn’t enable the modem, which we can do issuing:
$ sudo mmcli -m 0 --enable
successfully enabled the modem
$ mmcli -m 0 --location-status
----------------------------
Location | capabilities: 3gpp-lac-ci, gps-raw, gps-nmea
| enabled: 3gpp-lac-ci
| signals: no
We can start the GPS engine by enabling the RAW or NMEA GPS location sources:
$ sudo mmcli -m 0 \
--location-enable-gps-raw \
--location-enable-gps-nmea
successfully setup location gathering
If we do check again the status, we’ll see the GPS-specific locations are enabled:
$ mmcli -m 0 --location-status
--------------------------------
Location | capabilities: 3gpp-lac-ci, gps-raw, gps-nmea
| enabled: 3gpp-lac-ci, gps-raw, gps-nmea
| signals: no
You can query all location information at the same time with a single command. If any of the specific outputs is not available, the corresponding section will be omitted from the output.
$ sudo mmcli -m 0 --location-get
-------------------------
3GPP location | Mobile country code: 214
| Mobile network code: 3
| Location area code: 21071
| Cell ID: 7033737
-------------------------
GPS NMEA traces | $GPGGA,,,,,,0,,,,,,,,*66
| $GPRMC,,V,,,,,,,,,,N*53
| $GPGSA,A,1,,,,,,,,,,,,,,,*1E
| $GPGSV,4,1,16,24,,,,29,,,,05,,,,18,,,*7A
| $GPGSV,4,2,16,22,,,,14,,,,11,,,,17,,,*7B
| $GPGSV,4,3,16,03,,,,12,,,,30,,,,13,,,*78
| $GPGSV,4,4,16,23,,,,15,,,,27,,,,07,,,*79
| $GPVTG,,T,,M,,N,,K,N*2C
If A-GPS is enabled before starting the GPS engine, and if a data connection is available in the modem, the configured SUPL servers may be used to obtain a faster initial position fix.
Note that the GPS engine will not be started when just A-GPS capability is enabled. An explicit output (RAW or NMEA) is required to be enabled in order to start the GPS engine.
$ mmcli -m 0 --location-status
--------------------------------
Location | capabilities: 3gpp-lac-ci, gps-raw, gps-nmea, agps-msa, agps-msb
| enabled: 3gpp-lac-ci
| signals: no
-----------------------------
GPS | refresh rate: 30 seconds
| a-gps supl server: supl.google.com:7276
$ sudo mmcli -m 0 --location-enable-agps-msa
successfully setup location gathering
$ sudo mmcli -m 0 --location-enable-gps-nmea
successfully setup location gathering
$ sudo mmcli -m 0 --location-enable-gps-raw
successfully setup location gathering
If the modem device does not have an ongoing connection (e.g. no mobile network coverage) but the system has other means to access the Internet (e.g. WiFi), the user may be able to download location assistance data and inject it in the module.
E.g. If the device supports XTRA assistance data, the user may download it from one of the servers listed by ModemManager and manually inject it afterwards. The XTRA assistance data is usually valid for several days.
$ mmcli -m 0 --location-status
--------------------------------
Location | capabilities: 3gpp-lac-ci, gps-raw, gps-nmea, agps-msa, agps-msb
| enabled: 3gpp-lac-ci
| signals: no
--------------------------------
GPS | refresh rate: 30 seconds
| a-gps supl server: supl.google.com:7276
| supported assistance: xtra
| assistance servers: https://xtrapath3.izatcloud.net/xtra3grcej.bin
| https://xtrapath1.izatcloud.net/xtra3grcej.bin
| https://xtrapath2.izatcloud.net/xtra3grcej.bin
$ wget -q https://xtrapath3.izatcloud.net/xtra3grcej.bin
$ sudo mmcli -m 0 --location-inject-assistance-data=./xtra3grcej.bin
successfully injected assistance data
$ sudo mmcli -m 0 --location-enable-gps-nmea
successfully setup location gathering
$ sudo mmcli -m 0 --location-enable-gps-raw
successfully setup location gathering
Writing shell scripts that use mmcli to perform operations with the modem is easy when using the --output-keyvalue option. For example, you could gather all the main status information of the modem with a single call and then parse it to read single fields:
$ STATUS=$(mmcli -m 0 --output-keyvalue)
$ echo "${STATUS}" | grep "modem.generic.state " | awk -F
": " '{ print $2 }'
failed
$ echo "${STATUS}" | grep "modem.generic.state-failed-reason
" | awk -F ": " '{ print $2 }'
sim-missing
Written by Martyn Russell <martyn@lanedo.com> and Aleksander Morgado <aleksander@aleksander.es>
ModemManager(8), NetworkManager(8)
AT (http://en.wikipedia.org/wiki/AT_commands).
3GPP (http://en.wikipedia.org/wiki/3GPP).
MCCMNC (http://en.wikipedia.org/wiki/Mobile_Network_Code).
USSD (http://en.wikipedia.org/wiki/Unstructured_Supplementary_Service_Data).
CDMA (http://en.wikipedia.org/wiki/Code_division_multiple_access).
OTA (http://en.wikipedia.org/wiki/Over-the-air_programming).
GPS (http://en.wikipedia.org/wiki/Global_Positioning_System)
NMEA (http://en.wikipedia.org/wiki/NMEA_0183)
October 2012 | GNU |