aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2010-03-31 03:05:22 -0700
committerDan Williams <dcbw@redhat.com>2010-03-31 03:05:22 -0700
commit4d89b519b4c889859a84780a18dbb2f12c9a9438 (patch)
treefe019928b801db4f4b1e6ba88d8be2d327325059
parent40a713be6f8e8a40be7a72f674db5f105c59e8a2 (diff)
core: don't advance to next plugin until needed
Otherwise info->cur_plugin is wrong (and therefore we left uncleared supports tasks in MMPluginBase) when the port isn't supported by the plugin, but it's parent modem device was supported by the plugin. Like when all probing of the port fails but one of it's siblings has already been claimed by a modem; in this case we just drop the port (so that no other plugin could try to claim it, because only one plugin is allowed to handle all a modem's ports) but we still need to tell the parent modem's plugin to clean up the supports task.
-rw-r--r--src/mm-manager.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mm-manager.c b/src/mm-manager.c
index 21b5b582..6a2485eb 100644
--- a/src/mm-manager.c
+++ b/src/mm-manager.c
@@ -564,10 +564,6 @@ supports_callback (MMPlugin *plugin,
MMPlugin *next_plugin = NULL;
MMModem *existing;
- info->cur_plugin = info->cur_plugin->next;
- if (info->cur_plugin)
- next_plugin = MM_PLUGIN (info->cur_plugin->data);
-
/* Is this plugin's result better than any one we've tried before? */
if (level > info->best_level) {
info->best_level = level;
@@ -610,11 +606,20 @@ supports_callback (MMPlugin *plugin,
next_plugin = existing_plugin;
} else
g_assert_not_reached ();
+ } else {
+ info->cur_plugin = info->cur_plugin->next;
+ if (info->cur_plugin->next)
+ next_plugin = MM_PLUGIN (info->cur_plugin->data);
}
if (next_plugin) {
- /* Try the next plugin */
- try_supports_port (info->manager, next_plugin, existing, info);
+ const char *next_name = mm_plugin_get_name (next_plugin);
+
+ /* Try the next plugin, but don't bother with the Generic plugin if
+ * something already supports this port.
+ */
+ if (!info->best_plugin || strcmp (next_name, MM_PLUGIN_GENERIC_NAME))
+ try_supports_port (info->manager, next_plugin, existing, info);
} else {
/* All done; let the best modem grab the port */
info->done_id = g_idle_add (do_grab_port, info);