"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