Skip to content

Instantly share code, notes, and snippets.

@FinnWoelm
Created December 27, 2019 14:01
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save FinnWoelm/3396d09eec2ce1ba676b789308b345c1 to your computer and use it in GitHub Desktop.
Save FinnWoelm/3396d09eec2ce1ba676b789308b345c1 to your computer and use it in GitHub Desktop.
How to read text messages from USB modem
# Full instructions: http://manpages.ubuntu.com/manpages/bionic/en/man8/mmcli.8.html
# Examples: http://manpages.ubuntu.com/manpages/bionic/en/man8/mmcli.8.html#examples
# Supported modems: https://www.freedesktop.org/wiki/Software/ModemManager/SupportedDevices/
# Get list of connected modems.
mmcli --list-modems
# Output:
# Found 1 modems:
# /org/freedesktop/ModemManager1/Modem/1 [huawei] E3531
# The number at the end of the path is the modem index.
# In this case, that's the 1. We will use that to target
# the modem in all future commands:
# mmcli -m 1 ...
# Get list of received text messages
mmcli --modem 1 --messaging-list-sms
# Output:
# Found 1 SMS messages:
# /org/freedesktop/ModemManager1/SMS/0 (received)
# The number at the end of the path is the SMS index.
# Display the received text message
mmcli --modem 1 --sms 0
# Output:
# SMS '/org/freedesktop/ModemManager1/SMS/0'
# -----------------------------------
# Content | number: '+3376660xxxx'
# | text: 'Hello Finn'
# -----------------------------------
# Properties | PDU type: 'deliver'
# | state: 'received'
# | storage: 'me'
# | smsc: '+3369500xxxx'
# | timestamp: '191227144612+01'
@IreshMM
Copy link

IreshMM commented Jul 26, 2023

this was helpful. thanks you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment