Cleaning up SIM hot swap

Eric Caruso ejcaruso at chromium.org
Fri Jul 7 23:11:44 UTC 2017


While trying to implement setup_sim_hot_swap for MBIM modems, I
noticed that I am setting up and enabling unsolicited events for
SUBSCRIBER_INFO type notifications, but not cleaning them up. This
might not end up affecting the user since the destruction of the modem
object will disconnect the signal handler, but it means I might be
leaving the modem in a weird state when it's disabled or unplugged, so
I'm looking for a good place to clean up. I figured I could put this
in an MMBroadbandModemMbim override of
MMBroadbandModem::disabling_stopped, since that's where the
MMBroadbandModem cleans up the ports context for SIM hot swapping.
This override would launch a two chained asynchronous operations, and
while I can force them to happen synchronously in the
disabling_stopped method, this might not be the cleanest way to do it.

The better way structurally speaking would involve extending
MMIfaceModem to also have a cleanup_sim_hot_swap method which can be
called during an asynchronous disabling or destruction process.
However, MMIfaceModem doesn't actually do any asynchronous
destruction, or even have anything I can hook into to do destruction
of MMIfaceModem implementation details. This might be rearranging
things too much and adding too much extra boilerplate to support a
feature which might not be a priority.

Putting this in the disable path rather than a destruction path or the
dispose path would also mean that hot swapping remains disabled if we
disable and reenable the modem. This is currently the case with the
ports context as noted above. Should this be changed?

Thanks,
Eric


More information about the ModemManager-devel mailing list