Hotswapping/reprobing SIMcard

Anders Bruun bruunn at hotmail.com
Fri Dec 2 14:27:49 UTC 2016


Hi,

I'm working on an application which utilizes 4 simcards connected to 2 Sierra Wireless MC7304 modems, to manage an internet connection across internet providers / country borders / etc.

Simcards are separated by a GPIO-pin (high/low) to change simslots.

The goal is to disable a modem, set simcard in low-power-mode change the gpio-pin, set simcard in power-state-on and enable the modem, which will save time and prevent the modemmanager-interface from changing.


But, currently the only way I've found to change between simslots with libmm-glib/mmcli is to fully reset the modem after changing the gpio-pin with an AT!RESET.


Case 1: the first simslot is empty the modem goes to state: FAILED => reset,


Case 2: re-detect the new simcard after modem-low-power-mode needs a reset as well,


first case is fine, we are not interested in using the empty simslot so that switch can be ignored after initialization, but changing between available simcards "on-the-fly" is one of the points of the whole system, so not having to reset the modem is much preferred.


an example I've been testing with is manually swapping a single simcard (see output below, sorry it's quite large) while manually powering down the modem/simslot, using qmicli along with mmcli and at-commands.


[NOTE]


we added --uim-power-down and --uim-power-up to qmicli to switch the simslot-power on/off, and it's working as intended.


[/NOTE]


A working manual example is:


Detecting the modem and simcard =>


X at X:~/dev/ModemManager/ModemManager-1.6.4$ sudo qmicli -d /dev/cdc-wdm2 --dms-uim-get-iccid
[/dev/cdc-wdm2] UIM ICCID retrieved:
ICCID: '8945020184920077811'

X at X:~/dev/ModemManager/ModemManager-1.6.4$ ./cli/mmcli -L
Found 1 modems:
/org/freedesktop/ModemManager1/Modem/0 [Sierra Wireless, Incorporated] MC7304

listing modem 0 info =>

X at X:~/dev/ModemManager/ModemManager-1.6.4$ ./cli/mmcli -m 0

/org/freedesktop/ModemManager1/Modem/0 (device id '8bd0cad71e5b53259d0fce6e98dc209d822eb6a7')
  -------------------------
  Hardware |   manufacturer: 'Sierra Wireless, Incorporated'
           |          model: 'MC7304'
           |       revision: 'SWI9X15C_05.05.58.00 r27038 carmd-fwbuild1 2015/03/04 21:30:23'
           |      supported: 'gsm-umts
           |                  lte
           |                  gsm-umts, lte'
           |        current: 'gsm-umts, lte'
           |   equipment id: '356853051353789'
  -------------------------
  System   |         device: '/sys/devices/pci0000:00/0000:00:14.0/usb3/3-7'
           |        drivers: 'option1, qmi_wwan'
           |         plugin: 'Sierra'
           |   primary port: 'cdc-wdm1'
           |          ports: 'ttyUSB4 (at), ttyUSB2 (qcdm), cdc-wdm1 (qmi), cdc-wdm2 (qmi), wwan1 (net), wwan0 (net)'
  -------------------------
  Numbers  |           own : 'unknown'
  -------------------------
  Status   |           lock: 'sim-pin'
           | unlock retries: 'sim-pin (3), sim-pin2 (0), sim-puk (10), sim-puk2 (10)'
           |          state: 'locked'
           |    power state: 'on'
           |    access tech: 'unknown'
           | signal quality: '0' (cached)
  -------------------------
  Modes    |      supported: 'allowed: 2g, 3g, 4g; preferred: none'
           |        current: 'allowed: 2g, 3g, 4g; preferred: none'
  -------------------------
  Bands    |      supported: 'dcs, egsm, pcs, g850, u2100, u1900, u800, u850, u900, eutran-i, eutran-iii, eutran-vii, eutran-viii, eutran-xx'
           |        current: 'dcs, egsm, pcs, g850, u2100, u1900, u850, u900, eutran-i, eutran-iii, eutran-vii, eutran-viii, eutran-xx'
  -------------------------
  IP       |      supported: 'ipv4, ipv6, ipv4v6'
  -------------------------
  SIM      |           path: '/org/freedesktop/ModemManager1/SIM/0'

  -------------------------
  Bearers  |          paths: 'none'

X at X:~/dev/ModemManager/ModemManager-1.6.4$ ./cli/mmcli -i 0
SIM '/org/freedesktop/ModemManager1/SIM/0'
  -------------------------
  Properties |          imsi : 'unknown'
             |            id : '8945020184920077811'
             |   operator id : 'unknown'
             | operator name : 'unknown'


simcard is pinlocked, unlocking =>

X at X:~/dev/ModemManager/ModemManager-1.6.4$ ./cli/mmcli -i 0 --pin=XXXX
successfully sent PIN code to the SIM
X at X:~/dev/ModemManager/ModemManager-1.6.4$ ./cli/mmcli -i 0
SIM '/org/freedesktop/ModemManager1/SIM/0'
  -------------------------
  Properties |          imsi : 'unknown'
             |            id : '8945020184920077811'
             |   operator id : 'unknown'
             | operator name : 'unknown'

X at X:~/dev/ModemManager/ModemManager-1.6.4$ ./cli/mmcli -m 0
/org/freedesktop/ModemManager1/Modem/0 (device id '8bd0cad71e5b53259d0fce6e98dc209d822eb6a7')
  -------------------------
  Hardware |   manufacturer: 'Sierra Wireless, Incorporated'
           |          model: 'MC7304'
           |       revision: 'SWI9X15C_05.05.58.00 r27038 carmd-fwbuild1 2015/03/04 21:30:23'
           |      supported: 'gsm-umts
           |                  lte
           |                  gsm-umts, lte'
           |        current: 'gsm-umts, lte'
           |   equipment id: '356853051353789'
  -------------------------
  System   |         device: '/sys/devices/pci0000:00/0000:00:14.0/usb3/3-7'
           |        drivers: 'option1, qmi_wwan'
           |         plugin: 'Sierra'
           |   primary port: 'cdc-wdm1'
           |          ports: 'ttyUSB4 (at), ttyUSB2 (qcdm), cdc-wdm1 (qmi), cdc-wdm2 (qmi), wwan1 (net), wwan0 (net)'
  -------------------------
  Numbers  |           own : 'unknown'
  -------------------------
  Status   |           lock: 'sim-puk2'
           | unlock retries: 'sim-pin (3), sim-pin2 (0), sim-puk (10), sim-puk2 (10)'
           |          state: 'enabled'
           |    power state: 'on'
           |    access tech: 'unknown'
           | signal quality: '59' (recent)
  -------------------------
  Modes    |      supported: 'allowed: 2g, 3g, 4g; preferred: none'
           |        current: 'allowed: 2g, 3g, 4g; preferred: none'
  -------------------------
  Bands    |      supported: 'dcs, egsm, pcs, g850, u2100, u1900, u800, u850, u900, eutran-i, eutran-iii, eutran-vii, eutran-viii, eutran-xx'
           |        current: 'dcs, egsm, pcs, g850, u2100, u1900, u850, u900, eutran-i, eutran-iii, eutran-vii, eutran-viii, eutran-xx'
  -------------------------
  IP       |      supported: 'ipv4, ipv6, ipv4v6'
  -------------------------
  3GPP     |           imei: '356853051353789'
           |  enabled locks: 'sim'
           |    operator id: 'unknown'
           |  operator name: 'unknown'
           |   subscription: 'unknown'
           |   registration: 'idle'
  -------------------------
  SIM      |           path: '/org/freedesktop/ModemManager1/SIM/0'

  -------------------------
  Bearers  |          paths: 'none'


All well modem and simcard detected and unlocked/enabled, but when changing the simcard:


X at X:~/dev/ModemManager/ModemManager-1.6.4$ ./cli/mmcli -m 0 -d
successfully disabled the modem
X at X:~/dev/ModemManager/ModemManager-1.6.4$ sudo qmicli -d /dev/cdc-wdm2 --uim-power-down
[/dev/cdc-wdm2] Successfully performed SIM power down

****** MANUALLY SWAPPING SIMCARD ******

X at X:~/dev/ModemManager/ModemManager-1.6.4$ sudo qmicli -d /dev/cdc-wdm2 --uim-power-up
[/dev/cdc-wdm2] Successfully performed SIM power up
X at X:~/dev/ModemManager/ModemManager-1.6.4$ sudo qmicli -d /dev/cdc-wdm2 --dms-uim-get-iccid
[/dev/cdc-wdm2] UIM ICCID retrieved:
ICCID: '8945061304160073201'


ICCID is now changed i.e. new simcard is detected =>


X at X:~/dev/ModemManager/ModemManager-1.6.4$ ./cli/mmcli -m 0 -e
successfully enabled the modem
X at X:~/dev/ModemManager/ModemManager-1.6.4$ ./cli/mmcli -m 0

/org/freedesktop/ModemManager1/Modem/0 (device id '8bd0cad71e5b53259d0fce6e98dc209d822eb6a7')
  -------------------------
  Hardware |   manufacturer: 'Sierra Wireless, Incorporated'
           |          model: 'MC7304'
           |       revision: 'SWI9X15C_05.05.58.00 r27038 carmd-fwbuild1 2015/03/04 21:30:23'
           |      supported: 'gsm-umts
           |                  lte
           |                  gsm-umts, lte'
           |        current: 'gsm-umts, lte'
           |   equipment id: '356853051353789'
  -------------------------
  System   |         device: '/sys/devices/pci0000:00/0000:00:14.0/usb3/3-7'
           |        drivers: 'option1, qmi_wwan'
           |         plugin: 'Sierra'
           |   primary port: 'cdc-wdm1'
           |          ports: 'ttyUSB4 (at), ttyUSB2 (qcdm), cdc-wdm1 (qmi), cdc-wdm2 (qmi), wwan1 (net), wwan0 (net)'
  -------------------------
  Numbers  |           own : 'unknown'
  -------------------------
  Status   |           lock: 'sim-puk2'
           | unlock retries: 'sim-pin (3), sim-pin2 (0), sim-puk (10), sim-puk2 (10)'
           |          state: 'enabled'
           |    power state: 'on'
           |    access tech: 'unknown'
           | signal quality: '59' (cached)
  -------------------------
  Modes    |      supported: 'allowed: 2g, 3g, 4g; preferred: none'
           |        current: 'allowed: 2g, 3g, 4g; preferred: none'
  -------------------------
  Bands    |      supported: 'dcs, egsm, pcs, g850, u2100, u1900, u800, u850, u900, eutran-i, eutran-iii, eutran-vii, eutran-viii, eutran-xx'
           |        current: 'dcs, egsm, pcs, g850, u2100, u1900, u850, u900, eutran-i, eutran-iii, eutran-vii, eutran-viii, eutran-xx'
  -------------------------
  IP       |      supported: 'ipv4, ipv6, ipv4v6'
  -------------------------
  3GPP     |           imei: '356853051353789'
           |  enabled locks: 'sim'
           |    operator id: 'unknown'
           |  operator name: 'unknown'
           |   subscription: 'unknown'
           |   registration: 'idle'
  -------------------------
  SIM      |           path: '/org/freedesktop/ModemManager1/SIM/0'

  -------------------------
  Bearers  |          paths: 'none'

X at X:~/dev/ModemManager/ModemManager-1.6.4$ ./cli/mmcli -i 0
SIM '/org/freedesktop/ModemManager1/SIM/0'
  -------------------------
  Properties
|          imsi : 'unknown'
|            id : '8945020184920077811'
|   operator id : 'unknown'
| operator name : 'unknown'



qmicli shows the new simcard detected, but mmcli shows the old simcard still attached,

is it possible to re-probe the simcard after the simcard-slot has been powered down/up without doing a full modem reset with mmcli/libmm ??
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/modemmanager-devel/attachments/20161202/9431d4fd/attachment-0001.html>


More information about the ModemManager-devel mailing list