Update SIM related data according to an event

Aleksander Morgado aleksander at aleksander.es
Fri Apr 8 11:29:41 UTC 2016


Hey,
>
> sorry for the long -email, but I got stuck again in another problem: the
> re-probe does not start when the ModemManager is in "SIM missing failed
> state" and mm_base_modem_set_valid(..., false) is called.
>
> The current, modified, initialization code has got the following new steps:
>
> 1. mm-iface-modem.c:interface_initialization_step has got a new step (sim
> hot swap) just before INITIALIZATION_STEP_UNLOCK_REQUIRED(1), where the
> modem code is called to
>
>     - enable QSS unsolicited (that signals when the SIM has been
> removed/inserted)
>     - register a handler to catch the unsolicited.
>

Ok.

> 2. mm-broadband-modem.c:initialize_step has got a new step (again sim hot
> swap), just after INITIALIZE_STEP_IFACE_FIRMWARE(2) where it
>
>     - checks whether the modem supports sim hot swap (with a property)
>     - creates a new instance of PortsContext and save a reference of it in
> ctx->self->priv->sim_hot_swap_ports
>

Hum... why is this separated from the previous thing? Don't you need
an always open port context to enable the unsolicited messages from
step 1?

> Now, when a modem's initialized and SIM is missing, I have: modem disabled
> and in failed state, QSS enabled, an handler set and the ports open. When
> the SIM is inserted again the handler
>
> 1. updates the state to MODEM_STATE_UNKNOWN
> 2. releases the PortContext kept open to receinve the unsolicited
> 3. calls mm_base_modem_set_valid(..., FALSE)
>
> but the re-probe does not start as I expected and I can't figure out why.
> Is there any precondition for having the reprobe starting as expected?
>

I'm confused now; I've been looking for the code that was supposed to
launch the re-probing and can't find it. The MMDevice that holds the
modem object should get notified that the modem is invalid, and it
should unexport and remove the modem; that's already there, but then
it isn't automatically launching a reprobe as far as I can see it. The
thing is that the set valid thing was initially done for RS232 modems,
where we set as invalid as soon as we end up getting timeouts for the
AT commands in the serial port, but it's also true that for RS232
modems, it's up to the MM user to request manual scans via DBus to
look for the modems... so the auto-reprobe wasn't mandatory in that
case really. You may need to add some additional logic in MMDevice, so
that if a modem gets invalid *and* ports haven't been removed yet, you
directly try to recreate the modem and wait to see what happens,
something like that?

> NOTES
>   (1) this step is here because the INITIALIZATION_STEP_UNLOCK_REQUIRED is
> the first one that recognizes that the SIM is missing and if so it makes
> initialization jumps to INITIALIZATION_STEP_LAST.
>   (2) This step is here because when iface-modem initialization fails, we
> jump directly to INITIALIZE_STEP_IFACE_FIRMWARE.
>

Ah, I see now, ok. You're abusing the fact that during the whole
initialization sequence the ports are kept open, so you can safely
create the port context in 2).

-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list