Update SIM related data according to an event

Aleksander Morgado aleksander at aleksander.es
Sat Mar 12 20:17:36 UTC 2016


On Fri, Mar 11, 2016 at 5:21 PM, Carlo Lobrano <c.lobrano at gmail.com> wrote:
> I'm trying to update some modem data according to an unsolicited event.
>
> Telit modems have an unsolicited indication #QSS (Query SIM Status) which is
> emitted when the SIM status changes (e.g. SIM removed/inserted).
>
> My intention is to register an handler to this notification and somehow
> trigger an update of the SIM related data when a #QSS event occurs, the
> problem is how to update those data?
>
> I tried a bit with some "update" functions like
> `mm_iface_modem_update_lock_info`, but since the SIM is not there anymore
> those command fail and the data (e.g. sim locked status, unlocked retries,
> etc.) do not change. Moreover, I tried with a modified version of
> modem_load_unlock_retries that unset the value of the retries
> (mm_unlock_retries_unset), but that doesn't seem to change the cached values
> (mmcli -m 0 still reports the old valued of unlock retries).
>
> I think I am missing somenthing and/or that I need a more systematic
> approach, like repeating the steps done when a modem is first initialized.
> Is this possible?

The current logic doesn't support SIM hot-swapping right away. What
should be happening is that whenever a modem loses the SIM card, it
should get disabled and then to moved to Failed state (i.e. still
exposed with the same modem ID, all values reset in the ifaces and
Failed state). Then, if the modem detects the SIM card again (MM
should keep that unsolicited message watch), it should trigger a full
re-probe from scratch. One key thing here is that MM doesn't keep a
port open if the modem is disabled/failed; in your case you would need
to do that to watch for #QSS. Another key thing is that if you trigger
the full re-probe the modem would change the modem ID, but that
shouldn't be an issue. All of this logic is not done, you'd need to
change a lot of things in the core logic, but that's fine :) I do have
a couple of modems which support hot swapping, so I could even test
myself some of your changes if needed.


-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list