blob: 81eae74504ffe4e2595990bb993a666c6cc0d038 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
{
"title": "ModemManager essentials",
"subtitle": "Handling modems from the Linux command line"
}
#### Introduction
The software [ModemManager][4] handles modems on Linux operating systems. It
has the `mmcli` command line utility included which exposes its functionality.
It is possible to use `mmcli` to setup mobile internet connections, make phone
calls and send SMS.
This article summarizes some basic `mmcli` commands. It was written to further
debug the issue described in [this postmarketOS issue][5].
#### Get modem summary
With this command a summary about the modem is printed. It assumes just one
connected modem (`-m any`) which should be given on nearly all devices:
```
mmcli -m any
```
#### Unlock a SIM card
To actually do something with the modem it might be necessary to unlock the
inserted SIM card:
```
# this command needs appropriate polkit authentication or root permissions
mmcli -i "/org/freedesktop/ModemManager1/SIM/0" --pin "1234"
```
Use the SIM path listed in the summary (see section above).
#### Enable modem
In addition to unlocking the SIM card it is required to enable the modem:
```
# this command needs appropriate polkit authentication or root permissions
mmcli -m any -e
```
#### List calls
This command lists active, ringing, terminated and other calls:
```
mmcli -m any --voice-list-calls
```
The idea is that calls are tracked with the identifiers printed by this command
which allows to send additional commands like accept or hangup.
#### Accept a call
An incoming call can be accepted like this:
```
# this command needs appropriate polkit authentication or root permissions
mmcli -m any -o "/org/freedesktop/ModemManager1/Call/0" --accept
```
#### Hangup a call
Any active call can be hung up like this:
```
# this command needs appropriate polkit authentication or root permissions
mmcli -m any -o "/org/freedesktop/ModemManager1/Call/0" --hangup
```
#### Create a call
To create a call one can use the following command. Take care to select the
right phone number format. Given is an example phone number with German
international prefix `+49`.
```
mmcli -m any --voice-create-call "number=+49123456789"
```
This command just registeres a new call. To actually start it one has to get
its identifier with listing all calls and then start it like this:
```
# this command needs appropriate polkit authentication or root permissions
mmcli -m any -o "/org/freedesktop/ModemManager1/Call/4" --start
```
It can be hung up like incoming calls.
#### Further documentation
Running `mmcli --help` and the there listed help commands provide a summary of
all the functionality ModemManager provides. This article is just a brief
subset of it.
The [SXMO modem scripts][1] from the [SXMO project][2] helped me a lot to write
this summary aswell as the [Chromium mmcli help page][3].
Of course the [ModemManager homepage][4] is the most official entry point to
search for further documentation.
[1]: https://git.sr.ht/~mil/sxmo-utils/tree/master/item/scripts/modem
[2]: https://sxmo.org/
[3]: https://www.chromium.org/chromium-os/how-tos-and-troubleshooting/debugging-3g/modem-debugging-with-mmcli/
[4]: https://www.freedesktop.org/wiki/Software/ModemManager/
[5]: https://gitlab.com/postmarketOS/pmaports/-/issues/2113
|