Dual SIM slots and "--set-primary-sim-slot" UI
Bjørn Mork
bmork at telenor.net
Wed Apr 21 08:40:43 UTC 2021
Hello!
I got myself a new toy in the form of a board with dual SIM slots and a
Quectel RG502Q-EA modem. Which are hardware features I haven't had
access to before.
So I wanted to play with the dual SIM slot support in MM. The short
version is: It works like a charm!
The UI confused me at first, though.
I had this:
-----------------------------------
3GPP EPS | initial bearer ip type: ipv4v6
-----------------------------------
SIM | primary sim path: /org/freedesktop/ModemManager1/SIM/0
| sim slot paths: slot 1: /org/freedesktop/ModemManager1/SIM/0 (active)
| slot 2: /org/freedesktop/ModemManager1/SIM/1
-----------------------------------
Bearer | paths: /org/freedesktop/ModemManager1/Bearer/0
root at finn:~# mmcli -i 0
-------------------------------
General | path: /org/freedesktop/ModemManager1/SIM/0
-------------------------------
Properties | active: yes
| imsi: 24201308500xxxx
| iccid: 8947000020070700yyyy
| operator id: 24201
| operator name: TELENOR
root at finn:~# mmcli -i 1
-------------------------------
General | path: /org/freedesktop/ModemManager1/SIM/1
-------------------------------
Properties | active: no
| iccid: 8947030512101100zzzz
Wanted to switch the active/primary SIM to /org/freedesktop/ModemManager1/SIM/1,
so I did:
root at finn:~# mmcli -m any --set-primary-sim-slot=1
successfully requested primary SIM switch in modem
which of course didn't work. For reasons that were not obvious to me at
all. I got the "Doh!" moment only after after resetting the modem and
ending up with the SIM paths
/org/freedesktop/ModemManager1/SIM/2
/org/freedesktop/ModemManager1/SIM/3
and got:
root at finn:~# mmcli -v -m any --set-primary-sim-slot=3
[20 Apr 2021, 21:45:51] [Debug] ModemManager process found at ':1.5'
[20 Apr 2021, 21:45:51] [Debug] Will look for first available modem
[20 Apr 2021, 21:45:51] [Debug] Modem found at '(null)'
error: couldn't request primary SIM switch: 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.InvalidArgs: Cannot switch sim: requested SIM slot number is out of bounds'
So this worked like I wanted it to:
root at finn:~# mmcli -v -m any --set-primary-sim-slot=2
[20 Apr 2021, 21:46:02] [Debug] ModemManager process found at ':1.5'
[20 Apr 2021, 21:46:02] [Debug] Will look for first available modem
[20 Apr 2021, 21:46:02] [Debug] Modem found at '(null)'
successfully requested primary SIM switch in modem
And switched the active slot from /org/freedesktop/ModemManager1/SIM/2
to /org/freedesktop/ModemManager1/SIM/3:
-----------------------------------
3GPP EPS | initial bearer path: /org/freedesktop/ModemManager1/Bearer/1
| initial bearer ip type: ipv4v6
-----------------------------------
SIM | primary sim path: /org/freedesktop/ModemManager1/SIM/3
| sim slot paths: slot 1: /org/freedesktop/ModemManager1/SIM/2
| slot 2: /org/freedesktop/ModemManager1/SIM/3 (active)
root at finn:~# mmcli -i 2
-------------------------------
General | path: /org/freedesktop/ModemManager1/SIM/2
-------------------------------
Properties | active: no
| imsi: 24201308500xxxx
| iccid: 8947000020070700yyyy
| operator id: 24201
| operator name: TELENOR
root at finn:~# mmcli -i 3
-------------------------------
General | path: /org/freedesktop/ModemManager1/SIM/3
-------------------------------
Properties | active: yes
| imsi: 24201305013wwww
| iccid: 8947030512101100zzzz
| operator id: 24201
| operator name: TELENOR
I understand now that the --set-primary-sim-slot parameter refers to the
fixed modem slot numbers 1 and 2, regardless of which index the SIM is
mapped to. So --sim=3 and --set-primary-sim-slot=2 refer to the same
SIM card. As do --sim=2 and --set-primary-sim-slot=1.
OK, I accept that slots and cards are two different objects, with their
own namespace. But I really found this confusing at first. Not sure
what I'd want instead, though ;-) Just mentioning it here to document my
stupidity, in the hope it helps others struggling with the same issue.
And of course to have an excuse to thank you again for the excellent
work on ModemManager. Having stuff like that SIM slot switch just work
out-of-the-box is really impressing me. Thanks!
Now on to testing QMAP and session multiplexing over qmi_wwan :-)
Guess I have to build a version with that support first - the above was
tested on OpenWrt master with its default MM version (1.16.2.). My test
hardware is a ZyXEL NR7101 outdoor CPE, BTW.
Bjørn
More information about the ModemManager-devel
mailing list