[PATCH] mm-broadband-modem-mbim: support hot swapping

Carlo Lobrano c.lobrano at gmail.com
Thu Jun 29 10:22:30 UTC 2017


Hi,

> If I'm not mistaken, whenever a sim insert/removal event is detected, we
should just call
> mm_broadband_modem_update_sim_hot_swap_detected(), which will trigger a
full modem re-probe.

yes, I confirm this. *mm_broadband_modem_update_sim_hot_swap_detected* will
trigger full re-probe and disable current modem.

Here is the code in telit plugin


​133     *if* ((prev_qss_status == QSS_STATUS_SIM_REMOVED && cur_qss_status
!= QSS_STATUS_SIM_REMOVED) ||
134         (prev_qss_status > QSS_STATUS_SIM_REMOVED && cur_qss_status ==
QSS_STATUS_SIM_REMOVED)) {
135         mm_info ("QSS: SIM swap detected");
136         mm_broadband_modem_update_sim_hot_swap_detected (
MM_BROADBAND_MODEM (self));
137     }
​
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,
*mm_broadband_modem_update_sim_hot_swap_detected* should be called

    if self->priv->last_ready_state != ready_state:
        mm_broadband_modem_update_sim_hot_swap_detected (...)


On 29 June 2017 at 11:08, Aleksander Morgado <aleksander at aleksander.es>
wrote:

> On 29/06/17 10:51, Aleksander Morgado wrote:
> >> +    if (self->priv->last_ready_state != MBIM_SUBSCRIBER_READY_STATE_SIM_NOT_INSERTED
> &&
> >> +        ready_state == MBIM_SUBSCRIBER_READY_STATE_SIM_NOT_INSERTED) {
> >> +        /* SIM has been removed */
> >> +        mm_iface_modem_update_failed_state (MM_IFACE_MODEM (self),
> >> +
> MM_MODEM_STATE_FAILED_REASON_SIM_MISSING);
> >> +    } else if (self->priv->last_ready_state ==
> MBIM_SUBSCRIBER_READY_STATE_SIM_NOT_INSERTED &&
> >> +               ready_state != MBIM_SUBSCRIBER_READY_STATE_SIM_NOT_INSERTED)
> {
> >> +        /* SIM has been reinserted */
> >> +        mm_broadband_modem_update_sim_hot_swap_detected
> (MM_BROADBAND_MODEM (self));
> >> +    }
> >>
> > If I'm not mistaken, whenever a sim insert/removal event is detected, we
> should just call mm_broadband_modem_update_sim_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.
> >
>
> Also, could you provide MM debug logs showing the SIM card hot insertion
> and the SIM card hot removal?
>
> --
> Aleksander
> https://aleksander.es
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/modemmanager-devel/attachments/20170629/ae05d921/attachment-0001.html>


More information about the ModemManager-devel mailing list