From 72db2a53ed114a6b46515130a6ed8238eba35bfe Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Mon, 3 Sep 2012 17:20:29 +0200 Subject: [PATCH] plugin: defer task if supports check tells us to retry Huawei modems will probe interface 0 always first; if we try to probe another interface meanwhile the supports check will give us a MM_CORE_ERROR_RETRY error, indicating that we need to defer the probing of the port. --- src/mm-plugin.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/mm-plugin.c b/src/mm-plugin.c index a8009976..8db4c049 100644 --- a/src/mm-plugin.c +++ b/src/mm-plugin.c @@ -477,8 +477,18 @@ port_probe_run_ready (MMPortProbe *probe, g_simple_async_result_set_op_res_gpointer (ctx->result, GUINT_TO_POINTER (MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED), NULL); - } else { - /* For remaining errors, just propagate them */ + } + /* Probing failed but the plugin tells us to retry; so we'll defer the + * probing a bit */ + else if (g_error_matches (error, + MM_CORE_ERROR, + MM_CORE_ERROR_RETRY)) { + g_simple_async_result_set_op_res_gpointer (ctx->result, + GUINT_TO_POINTER (MM_PLUGIN_SUPPORTS_PORT_DEFER), + NULL); + } + /* For remaining errors, just propagate them */ + else { g_simple_async_result_take_error (ctx->result, error); } } else {