Re: Dual SIM slots and "--set-primary-sim-slot" UI

2021-04-21 Thread Aleksander Morgado
Hey!

>
> 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!
>

Nice!

> 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@finn:~# mmcli -i 0
>---
>General|  path: /org/freedesktop/ModemManager1/SIM/0
>---
>Properties |active: yes
>   |  imsi: 24201308500
>   | iccid: 894720070700
>   |   operator id: 24201
>   | operator name: TELENOR
>  root@finn:~# mmcli -i 1
>---
>General|  path: /org/freedesktop/ModemManager1/SIM/1
>---
>Properties |active: no
>   | iccid: 8947030512101100
>
>
> Wanted to switch the active/primary SIM to 
> /org/freedesktop/ModemManager1/SIM/1,
> so I did:
>
>  root@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@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@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@finn:~# mmcli -i 2
>---
>General|  path: /org/freedesktop/ModemManager1/SIM/2
>---
>Properties |active: no
>   |  imsi: 24201308500
>   | iccid: 894720070700
>   |   operator id: 24201
>   | operator name: TELENOR
>  root@finn:~# mmcli -i 3
>---
>General|  path: /org/freedesktop/ModemManager1/SIM/3
>   ---
>Properties |active: yes
>   |  imsi: 24201305013
>   | iccid: 8947030512101100
>   |   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.

Exactly, yes.

> 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.
>

Yes, the DBus object number for the SIM is independent from the SIM
slot number. If you switch slots 10 times, the DBus object numbers
will go increasing all the time, while the slot numbers would still be
the same.

> 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 

Dual SIM slots and "--set-primary-sim-slot" UI

2021-04-21 Thread Bjørn Mork
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@finn:~# mmcli -i 0
   ---
   General|  path: /org/freedesktop/ModemManager1/SIM/0
   ---
   Properties |active: yes
  |  imsi: 24201308500
  | iccid: 894720070700
  |   operator id: 24201
  | operator name: TELENOR
 root@finn:~# mmcli -i 1
   ---
   General|  path: /org/freedesktop/ModemManager1/SIM/1
   ---
   Properties |active: no
  | iccid: 8947030512101100


Wanted to switch the active/primary SIM to /org/freedesktop/ModemManager1/SIM/1,
so I did:

 root@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@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@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@finn:~# mmcli -i 2
   ---
   General|  path: /org/freedesktop/ModemManager1/SIM/2
   ---
   Properties |active: no
  |  imsi: 24201308500
  | iccid: 894720070700
  |   operator id: 24201
  | operator name: TELENOR
 root@finn:~# mmcli -i 3
   ---
   General|  path: /org/freedesktop/ModemManager1/SIM/3
  ---
   Properties |active: yes
  |  imsi: 24201305013
  | iccid: 8947030512101100
  |   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