<div dir="ltr"><div>Hello again, </div><div><br></div><div>As I mentioned, I have been able to detect when a 

SIM 

inserted in my 

SIM 

card holder when the application starts and also I have been able to detect 

SIM 

removals as the modem goes to "failed state". However, after this situation I insert the SIM card but the modem keeps reporting "failed state". It is only after a modem restart (I tried with mmcli -m <modem_number> -r ) when my modem is able to recover and report again that the SIM is inserted.</div><div><ul><li>Is there any way to avoid this modem restart and therefore to detect SIM additions after the modem is initiated ? </li><li>Is there any way to force the modem to "check" for new SIMs? </li></ul></div><div><br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> >>> >> I am developing an application which makes use of the libmm-glib high level API and I have been making some tests and I have not been able to detect when a SIM is added or removed (I know its not very common to >>add/extract it on runtime but I want to be aware of this in my app).<br>
> >>> >><br>
> >>><br>
> >>> >What modem are you using? We don't support SIM hotplug events on every<br>
> >>> > device out there. If I'm not mistaken, it's only available/enabled for<br>
> >>> > Telit and all MBIM based devices for now.<br>
> >><br>
> >><br>
> >>   At the moment I am trying to achieve this with a EM7455 Sierra Wireless modem.<br>
> >><br>
> >><br>
> ><br>
> >Is the modem being managed in MBIM or QMI mode? If you switch the<br>
> >modem to MBIM mode, you may get SIM hotswap supported.<br>
> ><br>
> >E.g. in my case my MC7455 is in AT+QMI mode:<br>
> ><br>
> >$ sudo qmicli -d /dev/cdc-wdm1 -p --dms-swi-get-usb-composition<br>
> >[/dev/cdc-wdm1] Successfully retrieved USB compositions:<br>
> >    [*] USB composition 6: DM, NMEA, AT, QMI<br>
> >        USB composition 8: DM, NMEA, AT, MBIM<br>
> >        USB composition 9: MBIM<br>
> ><br>
> >And I can switch it to AT+MBIM like this:<br>
> >$ sudo qmicli -d /dev/cdc-wdm1 -p --dms-swi-set-usb-composition=8<br>
> >$ sudo qmicli -d /dev/cdc-wdm1 -p --dms-set-operating-mode=offline<br>
> >$ sudo qmicli -d /dev/cdc-wdm1 -p --dms-set-operating-mode=reset<br>
><br>
> It seems like it was not a hardware related problem apparently but it was due to the hotswap support , which does not seem to exist in QMI mode as you stated before.<br>
> I tried switching my modem to MBIM mode and it worked. Now it is possible to guess when sim is added/removed while using the device .As you mentioned ,the modemmanager removes the modem from the list and creates another modem with sim-missing and modem failed state.<br>
><br>
> However, now I am not able to retrieve a valid ip for my modem and  I would like to ask you the following : how shall I connect my modem now ? Previously I launched DHCP after the modem manager reported "connected" state , but now it returns a timeout. I found this old post which may cover this issue : <a href="https://lists.freedesktop.org/archives/libmbim-devel/2015-May/000557.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/archives/libmbim-devel/2015-May/000557.html</a> . Shall I assign the IP to the interface manually now ? Is it enough with the following commands ?<br>
><br>
<br>
The way to connect the network interface is specified by ModemManager<br>
in the "bearer object information" that you get once you get the modem<br>
connected. There are 3 possible setups reported: see<br>
<a href="https://www.freedesktop.org/software/ModemManager/api/latest/ModemManager-Flags-and-Enumerations.html#MMBearerIpMethod" rel="noreferrer" target="_blank">https://www.freedesktop.org/software/ModemManager/api/latest/ModemManager-Flags-and-Enumerations.html#MMBearerIpMethod</a><br>
In your case, for MBIM modems we will always suggest using static IP<br>
addressing, because not all modems out there implement a DHCP server<br>
internally.<br>
<br>
<br>
> ifconfig <interface_name> <ip><br>
><br>
> ifconfig <interface_name> up<br>
><br>
<br>
These are not enough. You need to configure all settings provided in<br>
the "bearer object information", including: address, prefix, gateway,<br>
MTU and if needed also DNS.<br>
See <a href="https://www.freedesktop.org/software/ModemManager/api/latest/gdbus-org.freedesktop.ModemManager1.Bearer.html#gdbus-property-org-freedesktop-ModemManager1-Bearer.Ip4Config" rel="noreferrer" target="_blank">https://www.freedesktop.org/software/ModemManager/api/latest/gdbus-org.freedesktop.ModemManager1.Bearer.html#gdbus-property-org-freedesktop-ModemManager1-Bearer.Ip4Config</a><br>
<br>
><br>
> Will I find any other "differences" related to the connection or other elements when operating under QMI mode or MBIM mode ?<br>
><br>
<br>
If you look at the settings provided in the bearer after connection<br>
the MBIM modem or the QMI modem, it should have said the same thing,<br>
both should have suggested static IP addressing instead of DHCP,<br>
assuming your EM7455 was running using raw-ip link layer protocol<br>
instead of 802.3, which is definitely the case. We only suggest DHCP<br>
for QMI modems when the link layer protocol is 802.3 because that is<br>
what most DHCP clients support. So really, you shouldn't have seen any<br>
more differences, at least connection wise.<br>
<br>
-- <br>
Aleksander<br>
<a href="https://aleksander.es" rel="noreferrer" target="_blank">https://aleksander.es</a><br>
</blockquote></div><br clear="all"><div><br></div>Thank you again! <div><br><div dir="ltr" class="gmail_signature"><div dir="ltr">BR, <div><br></div><div>Alejandro Vega</div></div></div></div></div>