plugin-manager: never suggest result to the probe which generated the suggestion

This commit is contained in:
Aleksander Morgado
2012-08-29 18:43:01 +02:00
parent 72602a3951
commit 4114eabaa3

View File

@@ -74,6 +74,7 @@ typedef struct {
static void port_probe_context_step (PortProbeContext *port_probe_ctx); static void port_probe_context_step (PortProbeContext *port_probe_ctx);
static void suggest_port_probe_result (FindDeviceSupportContext *ctx, static void suggest_port_probe_result (FindDeviceSupportContext *ctx,
PortProbeContext *origin,
MMPlugin *suggested_plugin); MMPlugin *suggested_plugin);
static void static void
@@ -157,7 +158,7 @@ port_probe_context_finished (PortProbeContext *port_probe_ctx)
if (cancel_remaining) if (cancel_remaining)
/* Set a NULL suggested plugin, will cancel the probes */ /* Set a NULL suggested plugin, will cancel the probes */
suggest_port_probe_result (ctx, NULL); suggest_port_probe_result (ctx, port_probe_ctx, NULL);
} else { } else {
/* Notify the plugin to the device, if this is the first port probing /* Notify the plugin to the device, if this is the first port probing
@@ -171,7 +172,7 @@ port_probe_context_finished (PortProbeContext *port_probe_ctx)
mm_device_set_plugin (ctx->device, G_OBJECT (port_probe_ctx->best_plugin)); mm_device_set_plugin (ctx->device, G_OBJECT (port_probe_ctx->best_plugin));
/* Suggest this plugin also to other port probes */ /* Suggest this plugin also to other port probes */
suggest_port_probe_result (ctx, port_probe_ctx->best_plugin); suggest_port_probe_result (ctx, port_probe_ctx, port_probe_ctx->best_plugin);
} }
/* Warn if the best plugin found for this port differs from the /* Warn if the best plugin found for this port differs from the
* best plugin found for the the first probed port. */ * best plugin found for the the first probed port. */
@@ -213,6 +214,7 @@ deferred_support_check_idle (PortProbeContext *port_probe_ctx)
static void static void
suggest_port_probe_result (FindDeviceSupportContext *ctx, suggest_port_probe_result (FindDeviceSupportContext *ctx,
PortProbeContext *origin,
MMPlugin *suggested_plugin) MMPlugin *suggested_plugin)
{ {
GList *l; GList *l;
@@ -220,7 +222,8 @@ suggest_port_probe_result (FindDeviceSupportContext *ctx,
for (l = ctx->running_probes; l; l = g_list_next (l)) { for (l = ctx->running_probes; l; l = g_list_next (l)) {
PortProbeContext *port_probe_ctx = l->data; PortProbeContext *port_probe_ctx = l->data;
if (!port_probe_ctx->best_plugin && if (port_probe_ctx != origin &&
!port_probe_ctx->best_plugin &&
!port_probe_ctx->suggested_plugin) { !port_probe_ctx->suggested_plugin) {
/* TODO: Cancel probing in the port if the plugin being /* TODO: Cancel probing in the port if the plugin being
* checked right now is not the one being suggested. * checked right now is not the one being suggested.