<div dir="ltr">That looks like a lot of work :D, better design all the changes before starting.<div>Brief recap</div><div>1. Put the modem in failed state</div><div>2. Keep a port open when in failed state but with handlers still assigned to unsolicited</div><div>3. start a full reprobe</div><div><br></div><div>Another problem I saw is that when the SIM is not inserted from the start, the modem is not initialized at all, so I cannot even set an handler to watch for unsolicited events. Do you think that is something that can be changed?</div><div><br></div><div>Carlo</div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, 12 Mar 2016 at 21:17 Aleksander Morgado <<a href="mailto:aleksander@aleksander.es">aleksander@aleksander.es</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, Mar 11, 2016 at 5:21 PM, Carlo Lobrano <<a href="mailto:c.lobrano@gmail.com" target="_blank">c.lobrano@gmail.com</a>> wrote:<br>
> I'm trying to update some modem data according to an unsolicited event.<br>
><br>
> Telit modems have an unsolicited indication #QSS (Query SIM Status) which is<br>
> emitted when the SIM status changes (e.g. SIM removed/inserted).<br>
><br>
> My intention is to register an handler to this notification and somehow<br>
> trigger an update of the SIM related data when a #QSS event occurs, the<br>
> problem is how to update those data?<br>
><br>
> I tried a bit with some "update" functions like<br>
> `mm_iface_modem_update_lock_info`, but since the SIM is not there anymore<br>
> those command fail and the data (e.g. sim locked status, unlocked retries,<br>
> etc.) do not change. Moreover, I tried with a modified version of<br>
> modem_load_unlock_retries that unset the value of the retries<br>
> (mm_unlock_retries_unset), but that doesn't seem to change the cached values<br>
> (mmcli -m 0 still reports the old valued of unlock retries).<br>
><br>
> I think I am missing somenthing and/or that I need a more systematic<br>
> approach, like repeating the steps done when a modem is first initialized.<br>
> Is this possible?<br>
<br>
The current logic doesn't support SIM hot-swapping right away. What<br>
should be happening is that whenever a modem loses the SIM card, it<br>
should get disabled and then to moved to Failed state (i.e. still<br>
exposed with the same modem ID, all values reset in the ifaces and<br>
Failed state). Then, if the modem detects the SIM card again (MM<br>
should keep that unsolicited message watch), it should trigger a full<br>
re-probe from scratch. One key thing here is that MM doesn't keep a<br>
port open if the modem is disabled/failed; in your case you would need<br>
to do that to watch for #QSS. Another key thing is that if you trigger<br>
the full re-probe the modem would change the modem ID, but that<br>
shouldn't be an issue. All of this logic is not done, you'd need to<br>
change a lot of things in the core logic, but that's fine :) I do have<br>
a couple of modems which support hot swapping, so I could even test<br>
myself some of your changes if needed.<br>
<br>
<br>
--<br>
Aleksander<br>
<a href="https://aleksander.es" rel="noreferrer" target="_blank">https://aleksander.es</a><br>
</blockquote></div>