diff options
author | Carlo Lobrano <c.lobrano@gmail.com> | 2016-08-08 15:47:18 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2016-08-10 09:39:27 +0200 |
commit | 60f4f9e57df90cf094fffb6896ffce8dba15d244 (patch) | |
tree | a611d459cc957f1c5bf3e16268d2d3b8ba082f9f /src/mm-device.c | |
parent | 3047522b2e494776d9aced64180e54c46e861de1 (diff) |
modem: support SIM hot swap
BaseModem
added reprobe property.
MMDevice
added logic to recreate the modem if it is set invalid and "to reprobe"
MMBroadbandModem
* added initialization step for SIM hot swap:
1. keep dedicated ports open to listen to modem's unsolicited
2. dedicated error management in case of initialization failure due to SIM missing
* added function to be called in order to act upon SIM insertion/removal:
1. close dedicated ports
2. set the modem to be reprobed
3. disable modem
* added SIM HOT SWAP boolean property
MMIfaceModem
* added initialization step for SIM hot swap, if supported by the plugin
* dedicated error management in case of initialization failure due to SIM missing
Diffstat (limited to 'src/mm-device.c')
-rw-r--r-- | src/mm-device.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mm-device.c b/src/mm-device.c index 665c95ee..2beb8559 100644 --- a/src/mm-device.c +++ b/src/mm-device.c @@ -489,8 +489,23 @@ modem_valid (MMBaseModem *modem, MMDevice *self) { if (!mm_base_modem_get_valid (modem)) { + GDBusObjectManagerServer *object_manager = self->priv->object_manager; + /* Modem no longer valid */ mm_device_remove_modem (self); + + if (mm_base_modem_get_reprobe (modem)) { + GError *error = NULL; + + if (!mm_device_create_modem (self, object_manager, &error)) { + mm_warn ("Could not recreate modem for device at '%s': %s", + mm_device_get_path (self), + error ? error->message : "unknown"); + g_error_free (error); + } else { + mm_dbg ("Modem recreated for device '%s'", mm_device_get_path (self)); + } + } } else { /* Modem now valid, export it, but only if we really have it around. * It may happen that the initialization sequence fails because the |