<div dir="ltr"><div>There are others here who can give better answers, but I have interest in supporting sim switching in ModemManager, and I am awake, so I will try to contribute.<br><br></div><div>I believe ModemManager uses libqmi in the same way that qmicli does, so I suspect that if qmicli can do it, that ModemManager should be capable of accessing those same functions. Since mmcli (and all other MM clients) can do anything that ModemManager's API exposes, we need to add some functions to the dbs API (at the very least) to make MM truly support it.</div><div><br></div><div>If we want to just list which sim slots are available, that would be easy. I don't know if most modems with multiple SIM slots let you read the data from non active SIMs, or if it only reports which slots have a card inserted. If we can get all the card data on at least some modems, that would be interesting, and we might be able to reuse the MMSim data structure, but I do not know if there are any issues in exporting a dbus through multiple properties on the same object (I assume it will be fine), or if there are some other dbus/gobject limitations/conventions that would make us make a new object to track extra SIM cards.<br></div><div><br></div><div>As for actually switching the active SIM, it should not be hard to just add a few functions to set the current SIM slot, but there will probably be debate about how to do it. Currently, a MMModem object has either zero or one SIM cards EVER in its lifecycle. Changing the SIM on an existing MMModem is not supported, and adding support to do this would cause a lot of problems without a thorough rethinking of several assumptions, plus many code changes. An alternate strategy would be to change the active SIM slot and then trigger the SIM hot swap logic, which will destroy the current MMModem, and create+initialize a new MMModem object for the same physical modem. This does mean that the modem ID would change, so your application code would need to be able to handle that. This is the plan I was expecting to use when I start supporting multiple SIM cards on a product line I am working with. <br></div><div><br></div><div>If you are in a hurry and it takes too long for people here to agree on an idea, or to implement that more correct solution, I would suggest you  make a personal patch that implements/exports just the features you need. It would likely not be merged into master, but that would get you going until a better solution is implemented.</div><div><br></div><div>Jessy Diamond Exum<br></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 5, 2021 at 9:01 PM Nick B <<a href="mailto:nickberry17@icloud.com">nickberry17@icloud.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hey,<br>
<br>
I would like to add support for SIM switching to ModemManager.proto for OpenWrt, but the only way to achieve this currently (AFAIK) is by using qmicli --sim-switch-slot. I have it working by calling qmicli, but is it possible to do it without depending on qmicli?  If not, would there there be any plans to make it possible to select the SIM slot via mmcli?  <br>
<br>
Best,<br>
Nick<br>
_______________________________________________<br>
ModemManager-devel mailing list<br>
<a href="mailto:ModemManager-devel@lists.freedesktop.org" target="_blank">ModemManager-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel</a><br>
</blockquote></div>