Watching for available SIMs on D-Bus
Aleksander Morgado
aleksander at aleksander.es
Mon May 6 11:01:34 UTC 2019
Hey,
> I need to collect informations about modems (for IMEI) and SIM cards
> (for IMSI) available to system over D-Bus.
>
> While listening to signal InterfacesAdded on interface
> org.freedesktop.DBus.ObjectManager does work as mentioned in
> documentation, ie. returning properties on newly discovered modem,
> I cannot get this work for SIm cards. Here listening to
> PropertiesChanged for both Modem or SIM interface does not
> return anything. Current "solution" is to look at SIM object
> path after while, which gets SIM a chance to be discovered,
> but I would prefer to know how to implement it "the right
> way" (tm).
>
The "manager" object in ModemManager implements
org.freedesktop.DBus.ObjectManager but ONLY for modem objects. This
means that the ObjectManager interface only notifies about
added/removed interfaces in modem objects.
Once you have the path for an existing modem object with a
"org.freedesktop.ModemManager1.Modem" interface, you should then
monitor the "Sim" property in that interface, which will give you the
DBus path to the SIM object available in the modem.
It is "guaranteed" by the implementation that the SIM path does NOT
change in the same modem object, though. If for any reason the SIM is
ejected and changed, the actual modem object will be completely
re-created and the modem object path will also change.
--
Aleksander
https://aleksander.es
More information about the ModemManager-devel
mailing list