Sim added / extracted not detected

Aleksander Morgado aleksander at aleksander.es
Wed Oct 16 13:08:13 UTC 2019


Hey,

>
> I am developing an application which makes use of the libmm-glib high level API and I have been making some tests and I have not been able to detect when a SIM is added or removed (I know its not very common to add/extract it on runtime but I want to be aware of this in my app).
>

What modem are you using? We don't support SIM hotplug events on every
device out there. If I'm not mistaken, it's only available/enabled for
Telit and all MBIM based devices for now.

> Whenever the SIM is removed the only change I can notice in the modem manager is that the modem transitions from connected to registered . Monitoring the modem with mmcli I see the following:
>
>         /org/freedesktop/ModemManager1/Modem/0: State changed, 'connecting' --> 'connected' (Reason: User request)
> [SIM REMOVED]
>         /org/freedesktop/ModemManager1/Modem/0: State changed, 'connected' --> 'registered' (Reason: User request)
>

Looks like the modem you're using doesn't support SIM hotplug, because
the "forced disconnection" seen here is not totally correctly handled.
The SIM removal does disconnect the connection, but ModemManager
thinks it is still registered in the network, because it didn't handle
any SIM removal event reported by the device.

> It is true that if I relaunch/restart or I restart the modem manager and the sim is missing the modem status reports failed and the sim status is sim-missing. However,  I believe this status should be reported without the need of restarting either the modem or the ModemManager. Is this possible ?

For devices for which SIM hotplug is supported (Telit and all MBIM as
said earlier), if you remove the SIM card the "modem object" will
disappear from the bus, and reappear as a new object (new "modem
index") with "failed" state and sim-missing SIM status. E.g. you would
see this:

/org/freedesktop/ModemManager1/Modem/0: State changed, 'connecting'
--> 'connected' (Reason: User request)
> [SIM REMOVED]
/org/freedesktop/ModemManager1/Modem/0/org/freedesktop/ModemManager1/Modem/0
disappears from bus
// MM re-probes the device without the SIM
/org/freedesktop/ModemManager1/Modem/1 appears with "failed" state and
"SIM missing"

-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list