<div dir="ltr"><div class="gmail_default"><div class="gmail_default"><font face="arial, helvetica, sans-serif">Hi,</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">> If I'm not mistaken, whenever a sim insert/removal event is detected, we should just call</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">> mm_broadband_modem_update_sim_hot_swap_detected(), which will trigger a full modem re-probe.</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">yes, I confirm this. <b>mm_broadband_modem_update_sim_hot_swap_detected</b> will trigger full re-probe and disable current modem.</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">Here is the code in telit plugin</font></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">​<span id="gmail-L133" style="font-family:monospace;color:rgb(0,0,0)"><font color="#a52a2a">133 </font></span><span style="font-family:monospace;color:rgb(0,0,0)">    </span><font color="#a52a2a" style="font-family:monospace"><b>if</b></font><span style="font-family:monospace;color:rgb(0,0,0)"> ((prev_qss_status == QSS_STATUS_SIM_REMOVED && cur_qss_status != QSS_STATUS_SIM_REMOVED) ||</span></div>










<div style="color:rgb(0,0,0)"><font face="monospace">
<span id="gmail-L134"><font color="#a52a2a">134 </font></span>        (prev_qss_status > QSS_STATUS_SIM_REMOVED && cur_qss_status == QSS_STATUS_SIM_REMOVED)) {<br>
<span id="gmail-L135"><font color="#a52a2a">135 </font></span>        <font color="#008b8b">mm_info </font>(<font color="#ff00ff">"QSS: SIM swap detected"</font>);<br>
<span id="gmail-L136"><font color="#a52a2a">136 </font></span>        <font color="#008b8b">mm_broadband_modem_update_sim_hot_swap_detected </font>(<font color="#008b8b">MM_BROADBAND_MODEM </font>(self));<br>
<span id="gmail-L137"><font color="#a52a2a">137 </font></span>    }<br>
</font>
</div>


<div class="gmail_default" style="font-family:arial,helvetica,sans-serif">​</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">The if condition is a bit complex here because we can have 4 different QSS states, but if we are tracing just 2 or them (SIM IN vs SIM OUT), and if I'm not wrong here, whenever last_ready_state and ready_state differ, <b>mm_broadband_modem_update_sim_hot_swap_detected</b> should be called</div><div class="gmail_default"><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">    if self->priv->last_ready_state != ready_state:</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">        mm_broadband_modem_update_sim_hot_swap_detected (...)</font></div></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 29 June 2017 at 11:08, Aleksander Morgado <span dir="ltr"><<a href="mailto:aleksander@aleksander.es" target="_blank">aleksander@aleksander.es</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 29/06/17 10:51, Aleksander Morgado wrote:<br>
>> +    if (self->priv->last_ready_state != MBIM_SUBSCRIBER_READY_STATE_<wbr>SIM_NOT_INSERTED &&<br>
>> +        ready_state == MBIM_SUBSCRIBER_READY_STATE_<wbr>SIM_NOT_INSERTED) {<br>
>> +        /* SIM has been removed */<br>
>> +        mm_iface_modem_update_failed_<wbr>state (MM_IFACE_MODEM (self),<br>
>> +                                            MM_MODEM_STATE_FAILED_REASON_<wbr>SIM_MISSING);<br>
>> +    } else if (self->priv->last_ready_state == MBIM_SUBSCRIBER_READY_STATE_<wbr>SIM_NOT_INSERTED &&<br>
>> +               ready_state != MBIM_SUBSCRIBER_READY_STATE_<wbr>SIM_NOT_INSERTED) {<br>
>> +        /* SIM has been reinserted */<br>
>> +        mm_broadband_modem_update_sim_<wbr>hot_swap_detected (MM_BROADBAND_MODEM (self));<br>
>> +    }<br>
>><br>
> If I'm not mistaken, whenever a sim insert/removal event is detected, we should just call mm_broadband_modem_update_sim_<wbr>hot_swap_detected(), which will trigger a full modem re-probe. In this case the method is only being called for the case where the SIM is inserted, not for when the SIM is removed.<br>
><br>
<br>
</span>Also, could you provide MM debug logs showing the SIM card hot insertion and the SIM card hot removal?<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Aleksander<br>
<a href="https://aleksander.es" rel="noreferrer" target="_blank">https://aleksander.es</a><br>
</font></span></blockquote></div><br></div>