aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2017-03-06 15:01:21 +0100
committerAleksander Morgado <aleksander@aleksander.es>2017-03-11 12:52:15 +0100
commite9d0989ed069b2b6f3deea438ef390998286601f (patch)
treea1a580307800ae0861aaf26f4f87842e0a270650
parent355633f8d6eceb6ef2de9fbca21f0eb2010fc047 (diff)
base-manager: remove MMDevice if support check fails
If the device support check fails, either with an error, or afterwards when trying to create a modem object, we must remove the MMDevice from the tracking table of devices, so that a manual scan request afterwards re-scans all ports. https://bugs.freedesktop.org/show_bug.cgi?id=100157
-rw-r--r--src/mm-base-manager.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mm-base-manager.c b/src/mm-base-manager.c
index 66096130..e662d9fb 100644
--- a/src/mm-base-manager.c
+++ b/src/mm-base-manager.c
@@ -160,12 +160,18 @@ device_support_check_ready (MMPluginManager *plugin_manager,
GError *error = NULL;
MMPlugin *plugin;
+ /* If the device support check fails, either with an error, or afterwards
+ * when trying to create a modem object, we must remove the MMDevice from
+ * the tracking table of devices, so that a manual scan request afterwards
+ * re-scans all ports. */
+
/* Receive plugin result from the plugin manager */
plugin = mm_plugin_manager_device_support_check_finish (plugin_manager, res, &error);
if (!plugin) {
mm_info ("Couldn't check support for device '%s': %s",
mm_device_get_uid (ctx->device), error->message);
g_error_free (error);
+ g_hash_table_remove (ctx->self->priv->devices, mm_device_get_uid (ctx->device));
find_device_support_context_free (ctx);
return;
}
@@ -178,6 +184,7 @@ device_support_check_ready (MMPluginManager *plugin_manager,
mm_warn ("Couldn't create modem for device '%s': %s",
mm_device_get_uid (ctx->device), error->message);
g_error_free (error);
+ g_hash_table_remove (ctx->self->priv->devices, mm_device_get_uid (ctx->device));
find_device_support_context_free (ctx);
return;
}