diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-07-22 20:59:38 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-08-06 20:07:50 +0200 |
commit | 1811bb015c79b319c517d0bd23ae04899d2bc981 (patch) | |
tree | 1e02448c61e3c3c5fbf77d012861a1fcbaaedca0 /src | |
parent | 793218bfdbe92806f231c59e6ecbb68b9bb3ec13 (diff) |
plugin-manager: relaunch probing when suggestion comes to deferred tasks
If a port support task was deferred until suggested, do not assume that the
suggested plugin actually supports the port, instead re-launch support check.
This covers the cases where a net port appears in a modem which only supports
AT ports (e.g. Nokia case).
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-plugin-manager.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/mm-plugin-manager.c b/src/mm-plugin-manager.c index d9809b71..afc41737 100644 --- a/src/mm-plugin-manager.c +++ b/src/mm-plugin-manager.c @@ -233,19 +233,23 @@ suggest_port_probe_result (FindDeviceSupportContext *ctx, /* If we got a task deferred until a suggestion comes, * complete it */ if (port_probe_ctx->defer_until_suggested) { - if (suggested_plugin) + if (suggested_plugin) { mm_dbg ("(%s): (%s/%s) deferred task completed, got suggested plugin", mm_plugin_get_name (suggested_plugin), g_udev_device_get_subsystem (port_probe_ctx->port), g_udev_device_get_name (port_probe_ctx->port)); - else + /* Advance to the suggested plugin and re-check support there */ + port_probe_ctx->current = g_list_find (port_probe_ctx->current, + port_probe_ctx->suggested_plugin); + } else { mm_dbg ("(%s/%s) deferred task cancelled, no suggested plugin", g_udev_device_get_subsystem (port_probe_ctx->port), g_udev_device_get_name (port_probe_ctx->port)); + port_probe_ctx->best_plugin = NULL; + port_probe_ctx->current = NULL; + } /* Schedule checking support, which will end the operation */ - port_probe_ctx->best_plugin = g_object_ref (port_probe_ctx->suggested_plugin); - port_probe_ctx->current = NULL; g_assert (port_probe_ctx->defer_id == 0); port_probe_ctx->defer_id = g_idle_add ((GSourceFunc)deferred_support_check_idle, port_probe_ctx); @@ -356,14 +360,23 @@ plugin_supports_port_ready (MMPlugin *plugin, case MM_PLUGIN_SUPPORTS_PORT_DEFER_UNTIL_SUGGESTED: /* If we arrived here and we already have a plugin suggested, use it */ if (port_probe_ctx->suggested_plugin) { - mm_dbg ("(%s): (%s/%s) task completed, got suggested plugin", - mm_plugin_get_name (port_probe_ctx->suggested_plugin), - g_udev_device_get_subsystem (port_probe_ctx->port), - g_udev_device_get_name (port_probe_ctx->port)); - /* Schedule checking support, which will end the operation */ - port_probe_ctx->best_plugin = g_object_ref (port_probe_ctx->suggested_plugin); - port_probe_ctx->current = NULL; + if (port_probe_ctx->suggested_plugin == plugin) { + mm_dbg ("(%s): (%s/%s) task completed, got suggested plugin", + mm_plugin_get_name (port_probe_ctx->suggested_plugin), + g_udev_device_get_subsystem (port_probe_ctx->port), + g_udev_device_get_name (port_probe_ctx->port)); + port_probe_ctx->best_plugin = g_object_ref (port_probe_ctx->suggested_plugin); + port_probe_ctx->current = NULL; + } else { + mm_dbg ("(%s): (%s/%s) re-checking support on deferred task, got suggested plugin", + mm_plugin_get_name (port_probe_ctx->suggested_plugin), + g_udev_device_get_subsystem (port_probe_ctx->port), + g_udev_device_get_name (port_probe_ctx->port)); + port_probe_ctx->current = g_list_find (port_probe_ctx->current, + port_probe_ctx->suggested_plugin); + } + /* Schedule checking support, which will end the operation */ port_probe_context_step (port_probe_ctx); return; } |