"Graceful" switch between 2 SIMs (RUT955)

I want to "gracefully" switch between the 2 SIMs, which can be installed in the RUT955. Not to do a reboot, after using uci to modify 'sim_select'.
Which would be the most graceful method ? Later on, to be used in coop with mwan3.

I don't have the device, and cannot find the internal modem details. Some thoughts:

There are GPIOs listed for modem power, modem reset, and SIM select: https://github.com/openwrt/openwrt/blob/a4e2766a5bfa1ac1c706d1cd58c6706ffdcde895/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches#L48

You could do some trial and error testing to see what is needed, or dig into what the OEM firmware does: https://wiki.teltonika-networks.com/wikibase/index.php?title=RUT955_Mobile#SIM_Switch

Not sure how much will be needed:

  • take down the OpenWrt modem interface. Example: ifdown wwan_sim0
  • power down the modem
  • switch sim
  • power up the modem
  • ?reset modem
  • Bring up the modem interface for the other SIM (ifup wwan_sim1), or instead you could update the apn (and any other different settings) of a single wwan interface when switching SIMs, and let hotplug handle the modem ifup.

If you do need to use GPIO, you can use the sysfs interface manually, https://openwrt.org/docs/techref/hardware/port.gpio#software, or through uci and gpio_switch

Something along the lines of:

ifdown wwan
sleep 1
uci set "system.modem_vbus.value"="0" && uci commit && \
/etc/init.d/gpio_switch reload
uci set "system.sim_sel.value"="0" && uci commit && \
/etc/init.d/gpio_switch reload
uci set "network.wwan.apn"="sim0_apn" && uci commit
uci set "system.modem_vbus.value"="1" && uci commit && \
/etc/init.d/gpio_switch reload

Did you get anywhere with this? Especially the mwan3 part. I am looking for the exact same information :slight_smile:

Took a long while, to come back to this issue, because put on hold, being a "nice to have" only. After stabilizing the RUT955 using wwan/wan/wifiwan with one SIM only, back to this one.
Here I have good and bad news. Good news, sometimes it works to switch the SIMs. Bad news: This is not reproducable. I have the suspicion, that somehow the toggling of system.@system[0].sim_sel=1/0, or system.sim_sel.value=1/0 is not always properly reflected to the modem, electrically, may be. Because, after toggling these values, on the cmd-port of the EC25-EU ttyUSB2 often I see QINISTAT=0, which means no SIM recognized. Power cycling the RUT usually helps here. Did anybody implement this SIM-switch successfully ?

Having problems when trying to switch SIMs (typical problem: wwan (19369): PIN status failed (sim_not_present) ) I need to ask, whether this
really works for somebody else. Ops using just one SIM works fine for me.

Having issues, when using a EC25-EU in a router with 2 SIM slots, which are supposed to be switched via GPIO: Anybody doing something like this ?

AFAIR, the SIM is initialized only once, during modem bootup. If you just switch the SIM, without resetting the modem it will eventually fail.

For a "quick runtime" SIM switch (with an external SIM switch circuit) I was using QMI UIM Power Down/Up requests (like e.g. power down the SIM, change SIM slot with GPIO, power up the SIM with some short delays between these operations). AFAIK, our uqmi doesn't support that but it's available in qmicli: https://www.freedesktop.org/software/libqmi/man/latest/qmicli.1.html (search for --uim-sim-power-on/off).