mmcli(1)
โจ mmcli ๐ Control and monitor the ModemManager โจ
User Commands, section 1 ๐
โจ NAME โจ
mmcli - Control and monitor the ModemManager ๐ฑ
๐ SYNOPSIS ๐
mmcli [OPTION...]
๐ธ DESCRIPTION ๐ธ
okay so ModemManager is a DBus-powered Linux daemon ๐ง and it gives you one unified, high level API for talking to (mobile broadband) modems. it acts as a standard RIL (Radio Interface Layer) ๐ก and different connection managers, like NetworkManager, can use it. the built-in plugin architecture is the real iconic part: ModemManager talks to really different kinds of modems through really different kinds of ports โจ. on top of the standard AT serial ports, it also supports Qualcomm-based QCDM and QMI ports ๐.
๐ฆ HELP OPTIONS ๐ฆ
-h,--helpโ shows you a summary of the options, sorted by group ๐--help-allโ shows every group and every option ๐--help-managerโ shows the manager specific options ๐--help-commonโ shows the common options ๐ซถ. these are used for defining the device an option operates on, like modems, bearers, SIMs, SMS's, etc.--help-modemโ shows the modem specific options ๐ฑ--help-3gppโ shows the 3GPP specific options ๐--help-cdmaโ shows the CDMA specific options ๐--help-simpleโ shows the simple options ๐. these are your go-to for getting connected or disconnected and understanding the state of things super fast, without stressing about the details โจ--help-locationโ shows the location or positioning specific options ๐--help-messagingโ shows the messaging specific options ๐ฌ. see also--help-sms, which is related ๐ซถ--help-cell-broadcastโ shows the cell broadcast specific options. is related. ๐--help-timeโ shows the time specific options โฐ--help-firmwareโ shows the firmware specific options ๐ง--help-omaโ shows the OMA specific options ๐ง--help-simโ shows the SIM card specific options ๐ณ--help-bearerโ shows the bearer specific options ๐ฆ--help-smsโ shows the SMS specific options ๐. see also--help-messaging, which is related ๐
๐ MANAGER OPTIONS ๐
-B,--get-daemon-versionโ asks for the version of the ModemManager daemon that's currently running ๐ฅ-G,--set-logging=[ERR|WARN|INFO|DEBUG]โ sets the logging level in the ModemManager daemon ๐. if you want the debugging info, go withDEBUG. every level aboveDEBUGgives you less detail, and honestly in most casesERR(for displaying errors) has the messages that matter most ๐
the default mode is ERR ๐
.
-L,--list-modemsโ lists the available modems ๐-M,--monitor-modemsโ lists the available modems and keeps watch for modems being added or removed ๐-S,--scan-modemsโ scans for any potential new modems ๐. this is only useful when you're expecting pure RS232 modems, since the kernel doesn't notify about those automatically ๐ฅฒ-I,--inhibit-device=[UID]โ inhibits a specific device so ModemManager won't use it ๐ซ. the UID you give should be the value of theDeviceproperty exposed by a given modem. that's equal to theID_MM_PHYSDEV_UIDif one is set, or otherwise equal to the full device sysfs path ๐ง .
โ ๏ธ this command won't exit right away, because that would quietly remove the inhibition. you have to stop themmcliprocess by hittingCtrl+Cto un-inhibit the device ๐.
when a device is inhibited this way, ModemManager will disable the modem (which stops any ongoing connection) and won't use it again until it's uninhibited ๐ญ.
--report-kernel-event=['KEY1=VALUE1,KEY2=VALUE2,...']โ manually reports kernel events, instead of relying on udev ๐. this is handy if the daemon is running with--no-auto-scan, or if the system was built without udev support ๐ ๏ธ.
the supported KEYs are:
'action'โ the action to report, one of'add'or'remove'. this one is required โ'subsystem'โ the subsystem of the specific port being reported, e.g.'tty'(for serial ports),'net'(for network interfaces), or'usbmisc'(for cdc-wdm ports) ๐'name'โ the name of the port being reported, e.g.'ttyACM0','wwan0'or'cdc-wdm0'๐ฆ'uid'โ the specific UID of the device, equivalent to theID_MM_PHYSDEV_UIDudev tag ๐. all ports reported with the same'UID'value are treated as part of the same device, which can be useful for modems with multiple platform TTYs ๐ซถ
--report-kernel-event-auto-scanโ when built with udev support but the daemon is running with--no-auto-scan, this lets you automatically report kernel events based on udev ๐ค
this command won't exit right away either ๐. you have to stop the mmcli process by hitting Ctrl+C to stop monitoring for new events โ.
๐ซง COMMON OPTIONS ๐ซง
all of the options below take a PATH or INDEX argument ๐ฏ. if you don't give an action, you get the default information about the modem, bearer, etc. instead โจ.
the PATH and INDEX get created automatically when the modem is plugged in ๐. you can find them with mmcli -L, which gives you something like this (for modems only):
Found 1 modems:
/org/freedesktop/ModemManager1/Modem/4
in this case, the INDEX is 4 and the PATH is the entire string above ๐
.
for bearers, SIMs and SMS, the PATH is slightly different ๐. the Modem part gets swapped out for the object name in use, like Bearer. for example:
/org/freedesktop/ModemManager1/Bearer/4
-m,--modem=[PATH|INDEX]โ specifies a modem ๐ฑ-b,--bearer=[PATH|INDEX]โ specifies a bearer ๐ฆ-i,--sim=[PATH|INDEX]โ specifies a SIM card ๐ณ-s,--sms=[PATH|INDEX]โ specifies an SMS ๐
๐ฑ MODEM OPTIONS ๐ฑ
all of the modem options below use the --modem or -m switch to pick which modem to act on ๐.
some operations need a MODE ๐. a MODE can be any combination of the modes the modem actually supports. in the perfect case, these 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 ๐-w,--monitor-stateโ keeps an eye on the state of a given modem ๐-e,--enableโ enables a given modem โก. this powers up the antenna, starts the automatic registration process, and generally gets the modem ready to be connected ๐-d,--disableโ disables a given modem ๐ด. this disconnects any existing connection(s) for the modem and puts it into a low power mode ๐-r,--resetโ resets the modem to the settings it had when it was power cycled ๐--factory-reset=CODEโ resets the modem to its original factory default settings ๐ญ
the CODE you provide is vendor specific ๐งพ. without the correct vendor code, this operation is unlikely to succeed ๐. this isn't a common user action, so maybe don't go poking at it just for fun ๐.
--command=COMMANDโ sends an AT COMMAND to the given modem ๐. for example, COMMAND could be'AT+GMM'to probe for phone model information ๐. this operation is only available when ModemManager is run in debug mode ๐ ๏ธ.--create-bearer=['KEY1=VALUE1,KEY2=VALUE2,...']โ creates a new packet data bearer for a given modem ๐. the KEYs and some VALUEs are listed below:'apn'โ the Access Point Name. required in 3GPP ๐ก'ip-type'โ the addressing type ๐งญ. given as aMMBearerIpFamilyvalue (e.g.'ipv4','ipv6','ipv4v6'). optional in 3GPP and CDMA'allowed-auth'โ the authentication method to use ๐. given as aMMBearerAllowedAuthvalue (e.g.'none|pap|chap|mschap|mschapv2|eap'). optional in 3GPP'user'โ the user name (if any) the network requires ๐. optional in 3GPP'password'โ the password (if any) the network requires ๐คซ. optional in 3GPP'allow-roaming'โ a flag for whether the connection is allowed while roaming ๐งณ, given as a boolean value (i.e'yes'or'no'). optional in 3GPP'rm-protocol'โ the protocol of the Rm interface ๐, given as aMMModemCdmaRmProtocolvalue (e.g.'async','packet-relay','packet-network-ppp','packet-network-slip','stu-iii'). optional in CDMA'number'โ the telephone number to dial โ๏ธ. required in POTS
--delete-bearer=[PATH|INDEX]โ deletes a bearer from a given modem ๐๏ธ--set-allowed-modes=[MODE1|MODE2|...]โ sets the allowed modes for a given modem ๐๏ธ. for the possible modes, check the top of this section ๐--set-preferred-mode=MODEโ sets the preferred MODE for the given modem ๐. the MODE must be one of the allowed modes you set with--set-allowed-modes. the possible MODE arguments are detailed at the top of this section ๐--set-current-bands=[BAND1|BAND2|...]โ sets the bands the modem should use ๐ป. these are frequency ranges. there are quite a few supported bands, and listing them all here would be extremely long, so for the details check out the MMModemBand documentation ๐
an example would be: 'egsm|dcs|pcs|g850', which selects all the GSM frequency bands ๐.
--set-primary-sim-slot=[SLOT]โ requests a switch to the primary SIM slot ๐
the given SLOT must be a valid slot number in the [1,N] range, where N is the number of SIM slots available in the system ๐ฐ.
--inhibitโ inhibits a specific modem so ModemManager won't use it ๐ซ. this is completely equivalent to--inhibit-device, with one difference: the modem has to be managed by the daemon at the time the inhibition is requested ๐ง.
โ ๏ธ this command won't exit right away, because that would quietly remove the inhibition. you have to stop themmcliprocess by hittingCtrl+Cto un-inhibit the device ๐.
when a device is inhibited this way, ModemManager will disable the modem (which stops any ongoing connection) and won't use it again until it's uninhibited ๐ญ.
โจ 3GPP OPTIONS โจ
okay so 3GPP stands for the 3rd Generation Partnership Project, which is basically a squad of telecom associations working together ๐ค these options are for devices that speak 3GPP ๐ฑ
you can also control USSD (Unstructured Supplementary Service Data) sessions with these, which is giving secret-code vibes ๐ต๏ธโโ๏ธ
every 3GPP option below uses --modem or -m to pick which modem it's acting on ๐
--3gpp-scanโ scans for available 3GPP networks ๐--3gpp-register-homeโ asks a given modem to register on its home network ๐
this registers with the default network(s) the modem specifies, bestie ๐
--3gpp-register-in-operator=MCCMNCโ asks a given modem to register on the network of the operator with the given MCCMNC (Mobile Country Code, Mobile Network Code) ๐ this code is used for GSM/LTE, CDMA, iDEN, TETRA and UMTS public land mobile networks and some satellite mobile networks. the ITU-T Recommendation E.212 is the one that defines mobile country codes, so that's where to look if you're curious ๐ค--3gpp-ussd-statusโ checks the status of ANY ongoing USSD session ๐--3gpp-ussd-initiate=COMMANDโ asks the given modem to start a USSD session withCOMMAND๐
for example, COMMAND could be '*101#' to check your current pre-pay balance ๐ธ
--3gpp-ussd-respond=RESPONSEโ when you start a USSD session, the network might send its own request and need aRESPONSEback. this option is how you answer it ๐ซถ--3gpp-ussd-cancelโ cancels an ongoing USSD session for a given modem ๐ โโ๏ธ--3gpp-disable-facility-lock=FACILITY,CONTROL_KEYโ turns off the selected facility lock using the control key you give it ๐FACILITYโ one of these lock types:'net-pers'โ network personalization'net-sub-pers'โ network subset personalization'provider-pers'โ provider personalization'corp-pers'โ corporate personalization
CONTROL_KEYโ the alphanumeric code that unlocks the facility ๐
โจ CDMA OPTIONS โจ
okay the CDMA (Code Division Multiple Access) options are all giving "you need --modem or -m first" ๐ no shortcuts here, bestie
--cdma-activate=CARRIERโ activates the given modem using OTA (Over the Air) settings ๐ก theCARRIERis a code the network hands over for the default settings they provide ๐
โจ SIMPLE OPTIONS โจ
every simple option has to be used with --modem or -m, no exceptions ๐
--simple-connect=['KEY1=VALUE1,KEY2=VALUE2,...']โ runs a full connection sequence using KEY / VALUE pairs ๐ you can use the--create-beareroptions too, plus any of these:'pin'โ your SIM-PIN unlock code ๐'operator-id'โ the ETSI MCC-MNC of a network you want to force registration on ๐ถ
--simple-disconnectโ disconnects ALL connected bearers for a given modem ๐
โจ LOCATION OPTIONS โจ
these are the location vibes ๐บ๏ธ they figure out where you are using Global Positioning System (GPS) or straight from your mobile network infrastructure (either 3GPP or 3GPP2) ๐ฐ๏ธ
every location option must be used with --modem or -m ๐
--location-statusโ shows the current status of discovering our location ๐งญ--location-getโ shows ALL the location information available ๐--location-enable-3gppโ turns on location discovery using the 3GPP network ๐ถ--location-disable-3gppโ turns off location discovery using the 3GPP network ๐ โโ๏ธ--location-enable-agps-msaโ turns on A-GPS (MSA) support ๐ฐ๏ธ heads up, this does NOT start the GPS engine by itself. it just says A-GPS should be enabled once the engine starts ๐ญ so you should enable A-GPS before the raw or NMEA outputs with--location-enable-gps-rawor--location-enable-gps-nmea, periodt โจ--location-disable-agps-msaโ turns off A-GPS (MSA) support ๐--location-enable-agps-msbโ turns on A-GPS (MSB) support ๐ฐ๏ธ same deal as MSA: it does NOT implicitly start the GPS engine, it just marks A-GPS as enabled when the engine starts ๐ญ so request A-GPS before the raw or NMEA outputs are enabled with--location-enable-gps-rawor--location-enable-gps-nmea๐ซถ--location-disable-agps-msbโ turns off A-GPS (MSB) support ๐ฅ--location-enable-gps-nmeaโ turns on location discovery using GPS, reported with NMEA traces ๐งพ
this command will start the GPS engine if it isn't already running ๐ฅ
--location-disable-gps-nmeaโ turns off location discovery using GPS and NMEA traces ๐
if the raw output isn't enabled at the same time, the GPS engine gets stopped too ๐
--location-enable-gps-rawโ turns on location discovery using GPS, reported with raw (i.e. longitude/latitude) values ๐
this command will start the GPS engine if it isn't already running ๐ฅ
--location-disable-gps-rawโ turns off location discovery using GPS and raw values ๐
if the NMEA output isn't enabled at the same time, the GPS engine will be stopped ๐
--location-enable-cdma-bsโ turns on location discovery using the 3GPP2 network ๐ก--location-disable-cdma-bsโ turns off location discovery using the 3GPP2 network ๐--location-enable-gps-unmanagedโ turns on location discovery using GPS WITHOUT taking control of the NMEA tty port ๐ค this lets other programs, e.g.gpsd, use the NMEA tty once the GPS engine is enabled ๐ง--location-disable-gps-unmanagedโ turns off location discovery using GPS and the unmanaged port ๐--location-set-gps-refresh-rate=SECโ sets the location refresh rate on the DBus interface toSECseconds โฑ๏ธ if you set it to0, the new location gets published on the DBus interface as soon as ModemManager detects it โก--location-set-supl-server=[IP:PORT]or--location-set-supl-server=[FQDN:PORT]โ configures the location of the A-GPS SUPL server ๐บ๏ธ you can give either the IP address (IP:PORT) or a fully qualified domain name ([FQDN:PORT]) ๐ธ--location-inject-assistance-data=[PATH]โ injects assistance data into the GNSS module, loaded from a local file atPATH๐ the data has to be in a format the device expects, e.g. stuff downloaded from the URLs exposed by the'AssistanceDataServers'property ๐ฆ--location-set-enable-signalโ enables reporting location updates through DBus property signals ๐ฃ this is needed if apps rely on listening to'Location'property updates, instead of asking directly with the policy-protected'GetLocation'method ๐
these DBus property signal updates are disabled by default, so you have to turn them on yourself ๐
--location-set-disable-signalโ disables reporting location updates through DBus property signals ๐
โจ MESSAGING OPTIONS โจ
all messaging options must be used with --modem or -m ๐
--messaging-statusโ shows the status of the messaging support ๐ฌ--messaging-list-smsโ lists the SMS messages available on a given modem ๐ฅ--messaging-create-sms=['KEY1=VALUE1,...']โ creates a new SMS on a given modem โ๏ธ these are the KEYs you can use:'number'โ the number the message is addressed to ๐ฑ'text'โ the message text, in UTF-8 ๐ฌ when sending, if the text is bigger than the limit of the technology or modem, the message gets broken into multiple parts or messages ๐งฉ heads up:textanddataare NEVER given at the same time ๐ โโ๏ธ'smsc'โ the SMS service center number ๐ข'validity'โ specifies when the SMS expires in the SMSC โ'class'โ the 3GPP message class (0..3) ๐ท๏ธ'delivery-report-request'โ specifies whether a delivery report is requested when sending the SMS ('yes'or'no') ๐จ'storage'โ specifies where this message is kept ๐๏ธ storages may be'sm','me','mt','sr','bm','ta'
--messaging-create-sms-with-data=PATHโ uses the file atPATHas the data for a new SMS ๐--messaging-create-sms-with-text=PATHโ uses the file atPATHas the message for a new SMS ๐--messaging-delete-sms=[PATH|INDEX]โ deletes an SMS from a given modem ๐๏ธ
โจ TIME OPTIONS โจ
all time operations require --modem or -m โฐ
--timeโ displays the current network time from the operator ๐ฐ๏ธ this includes the timezone, which is usually the important bit ๐
โจ VOICE OPTIONS โจ
all voice operations require --modem or -m ๐
--voice-list-callsโ lists the calls managed on a given modem (initiated, received, ongoing) โ๏ธ--voice-create-call=['KEY1=VALUE1,...']โ creates a new outgoing call on a given modem ๐ฒ these are the KEYs you can use:'number'โ the number to call ๐ค
--voice-delete-call=[PATH|INDEX]โ deletes a call from a given modem ๐ซฃ
โจ FIRMWARE OPTIONS โจ
all firmware options require --modem or -m ๐ ๏ธ
--firmware-statusโ shows firmware update specific details and properties ๐--firmware-listโ lists all the firmware images installed on a given modem ๐ฟ--firmware-select=IDโ selects a firmware image from the ones installed on a given modem ๐ฏ you can see the list of available firmware images with the--firmware-listoption ๐
the ID you give is a UNIQUE identifier for the firmware ๐
โจ SIGNAL OPTIONS โจ
all signal options require --modem or -m ๐ถ
--signal-setup=[Rate]โ sets up extended signal quality information retrieval at the specified rate (in seconds) โฒ๏ธ
by default this is disabled, meaning the rate is set to 0 ๐
--signal-getโ retrieves the last extended signal quality information that got loaded ๐
โจ OMA OPTIONS โจ
all OMA options require --modem or -m ๐
--oma-statusโ shows the status of the OMA device management subsystem ๐งโ๐ป--oma-start-client-initiated-session=[SESSION TYPE]โ requests to start a client initiated session ๐ฆ
the session type has to be one of these:
'client-initiated-device-configure''client-initiated-prl-update''client-initiated-hands-free-activation'
--oma-accept-network-initiated-session=[SESSION ID]โ requests to accept a network initiated session โ--oma-reject-network-initiated-session=[SESSION ID]โ requests to reject a network initiated session โ--oma-cancel-sessionโ requests to cancel the current OMA session, if there is one ๐ซ
โจ SIM OPTIONS โจ
okay so these are all about your SIM card ๐ณ and yes it's giving security guard energy ๐
--pin=PINโ sends your PIN code over to a given SIM card ๐--puk=PUKโ sends the PUK code to a given SIM card ๐ this one has to be used WITH--pinor it won't work ๐--enable-pinโ turns on the PIN request for a given SIM card ๐ must be used WITH--pintoo--disable-pinโ turns the PIN request off for a given SIM card ๐ must be used WITH--pinas well--change-pin=PINโ changes the PIN on a given SIM card so it becomes PIN ๐ this must be used WITH--pinso you can pass in the old PIN number
๐ซง BEARER OPTIONS ๐ซง
bestie, all bearer options need the --bearer or -b option first ๐
-c,--connectโ connects to a given bearer ๐-x,--disconnectโ disconnects from a given bearer ๐
๐ SMS OPTIONS ๐
all SMS options need the --sms or -s option, no cap ๐ซถ
--sendโ sends an SMS ๐จ--storeโ this one stores the SMS in the default storage the modem uses, which could be either modem-memory or SMS-memory ๐ง to check what the current default storage is, look at the--messaging-statusoption--store-in-storage=STORAGEโ this picks which STORAGE to use for SMS messages โจ the possible values are:'sm'โ the SIM card storage area ๐ณ'me'โ the mobile equipment storage area ๐ฑ'mt'โ the sum of SIM and mobile equipment storages ๐งฎ'sr'โ the status report message storage area ๐'bm'โ the broadcast message storage area ๐ข'ta'โ the terminal adaptor message storage area ๐
--create-file-with-data=PATHโ this takes an SMS that has DATA (not TEXT) and creates a local file at PATH, then saves the content of the SMS in there ๐
๐ CALL OPTIONS ๐
the call options, lowkey the most iconic part of this whole page ๐ฆ
--startโ starts an outgoing call ๐ฒ--acceptโ accepts an incoming call ๐ฅฐ--hangupโ rejects an incoming call, or hangs up an ongoing one ๐ด--send-dtmf=[0-9A-D*#]โ sends a DTMF sequence through an ongoing call ๐น
๐ APPLICATION OPTIONS ๐
these are the general app vibes that work across everything ๐ง
-J,--output-jsonโ runs the action with machine-friendly JSON output ๐ค this is perfect for shell scripts that rely on mmcli operations ๐-K,--output-keyvalueโ runs the action with machine-friendly key-value output ๐ also for shell scripts that rely on mmcli operations ๐-v,--verboseโ performs actions with more details reported and/or logged ๐-V,--versionโ returns the version of this program ๐ท๏ธ-a,--asyncโ uses asynchronous methods ๐ > this is purely a development tool and has no practical benefit to most user operations, so don't stress about it ๐--timeout=SECONDSโ uses SECONDS for the timeout when performing operations with this command โฐ this is super useful for long running operations, like--3gpp-scan๐ข
๐ก CELL BROADCAST OPTIONS ๐ก
all cell broadcast options must be used with the --modem or -m option ๐
--cell-broadcast-statusโ shows the status of the cell broadcast support ๐ถ--cell-broadcast-list-cbmโ lists the cell broadcast messages available on a given modem ๐--cell-broadcast-delete-cbm=[PATH|INDEX]โ deletes the cell broadcast message at the given path or index ๐๏ธ--cell-broadcast-set-channels=[CHANNELS]โ sets the list of channels that cell broadcasts get received on ๐ for example5370,5371-5372โจ
โจ EXAMPLES โจ
๐ฑ Send the PIN to the SIM card
okay so first things first, you need to figure out the proper path/index for the SIM in your modem bestie ๐ซถ grab it with this:
$ mmcli -m 0 -K | grep "modem.generic.sim" | awk -F ": " '{ print $2
}'
/org/freedesktop/ModemManager1/SIM/0
and once you've got that, you can just use the SIM index ๐
$ sudo mmcli -i 0 --pin=1234
successfully sent PIN code to the SIM
๐ Simple connect and disconnect
the simple connection process is giving effortless โจ
$ sudo mmcli -m 0 --simple-connect="pin=1234,apn=internet"
successfully connected the modem
and when you're done, disconnect like this ๐ฆ
$ sudo mmcli -m 0 --simple-disconnect
successfully disconnected all bearers in the modem
๐ก 3GPP network scan
ngl scanning for 3GPP networks can take forever ๐ญ so you have to give it a specific timeout:
$ 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)
๐ Creating a new SMS message & storing it
using the "sm" (SIM) storage, you can do this ๐
$ 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
๐ฆ Sending binary SMS messages from files
so the main stars here are --messaging-create-sms-with-data and the PATH you hand it ๐
$ 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
๐ฅ Listing SMS messages
once the receiver has every single part of the message, they can get the file back with another mmcli command on their own 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
๐ฐ๏ธ GPS location status
first things first, check whether the modem even has GPS-specific location capabilities ๐ we're assuming the modem is index 0 here, so if you have more than one modem, use --list-modems to find the right index:
$ mmcli -m 0 --location-status
----------------------------
Location | capabilities: 3gpp-lac-ci, gps-raw, gps-nmea
| enabled: none
| signals: no
so the output says the modem supports 3GPP Location area code/Cell ID, GPS raw and GPS-NMEA location sources โจ nothing is enabled yet because we haven't enabled the modem, which you can fix with:
$ 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
๐งญ GPS location technology enabling
you 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
and if you check the status again, the GPS-specific locations should now be 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
๐บ๏ธ GPS location retrieval
you can grab all the location info in one go with a single command ๐ซถ if any of the specific outputs isn't available, that section just gets left out of 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
๐ A-GPS support
if A-GPS is enabled before you start the GPS engine, and the modem has a data connection, the configured SUPL servers can be used to get a faster first position fix ๐
heads up though: the GPS engine won't start when only the A-GPS capability is enabled. you need an explicit output (RAW or NMEA) enabled to actually start it ๐
$ 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
๐ถ Injecting assistance data
okay this one is lowkey clever ๐ง if the modem has no ongoing connection (like no mobile network coverage) but your system can reach the Internet some other way (like WiFi), you may be able to download location assistance data and inject it into the modem yourself.
for example, if the device supports XTRA assistance data, you can download it from one of the servers ModemManager lists and inject it manually 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
๐ป Setting the Cell Broadcast channel list
the channel list can be a comma separated list of channels or channel intervals ๐ถ
$ sudo mmcli -m 0 \
--cell-broadcast-set-channels=5370,5371,5373-5000
successfully set channels in the modem
๐งพ Key-Value output
if you're writing shell scripts that poke the modem with mmcli, --output-keyvalue is your best friend ๐ you can grab all the main status info in one call and then parse out the fields you want, like so:
$ 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
โจ AUTHORS โจ
written by Martyn Russell <martyn@lanedo.com> and Aleksander Morgado <aleksander@aleksander.es> ๐ธ
๐ SEE ALSO ๐
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) ๐
bestie that's the whole page ๐ญ๐ you're officially a mmcli main character now ๐ this one's from GNU, October 2012, and it's the mmcli(1) page ๐๐
๐ฆ where this page comes from
- alpine 3.24: modemmanager-doc 1.25.95_git20260527-r1 ยท GPL-2.0-or-later AND LGPL-2.1-or-later
- arch rolling: modemmanager 1.24.2-2 ยท GPL-2.0-or-later
- debian trixie: modemmanager 1.24.0-1+deb13u1 ยท GPL-2.0-or-later
- fedora 43: ModemManager 1.24.2-1.fc43 ยท GPL-2.0-or-later
- fedora 43: ModemManager 1.24.2-1.fc43 ยท GPL-2.0-or-later
- fedora 44: ModemManager 1.24.2-3.fc44 ยท GPL-2.0-or-later
- fedora 44: ModemManager 1.24.2-3.fc44 ยท GPL-2.0-or-later
- nixos 26.05: modemmanager 1.24.2
- nixpkgs unstable: modemmanager 1.24.2
- ubuntu questing: modemmanager 1.24.2-0ubuntu1 ยท GPL-2.0-or-later
- ubuntu resolute: modemmanager 1.25.95-1ubuntu1 ยท GPL-2.0-or-later
- ubuntu stonking: modemmanager 1.25.95-1ubuntu1 ยท GPL-2.0-or-later
- Copyright (C) 2012 Martyn Russell
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms