diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-plugin-base.c | 15 | ||||
-rw-r--r-- | src/mm-plugin-manager.c | 25 | ||||
-rw-r--r-- | src/mm-plugin.h | 2 |
3 files changed, 34 insertions, 8 deletions
diff --git a/src/mm-plugin-base.c b/src/mm-plugin-base.c index 6ceaafab..6a64e19e 100644 --- a/src/mm-plugin-base.c +++ b/src/mm-plugin-base.c @@ -617,15 +617,18 @@ supports_port (MMPlugin *plugin, } /* Before launching any probing, check if the port is a net device (which - * cannot be probed). */ + * cannot be probed). + * TODO: With the new defer-until-suggested we probably don't need the modem + * object being passed down here just for this. */ if (g_str_equal (subsys, "net")) { /* If we already have a existing modem, then mark it as supported. * Otherwise, just defer a bit */ - g_simple_async_result_set_op_res_gpointer (async_result, - GUINT_TO_POINTER ((existing ? - MM_PLUGIN_SUPPORTS_PORT_SUPPORTED : - MM_PLUGIN_SUPPORTS_PORT_DEFER)), - NULL); + g_simple_async_result_set_op_res_gpointer ( + async_result, + GUINT_TO_POINTER ((existing ? + MM_PLUGIN_SUPPORTS_PORT_SUPPORTED : + MM_PLUGIN_SUPPORTS_PORT_DEFER_UNTIL_SUGGESTED)), + NULL); g_simple_async_result_complete_in_idle (async_result); goto out; } diff --git a/src/mm-plugin-manager.c b/src/mm-plugin-manager.c index 5cba7711..3218a2c6 100644 --- a/src/mm-plugin-manager.c +++ b/src/mm-plugin-manager.c @@ -271,6 +271,30 @@ supports_port_ready_cb (MMPlugin *plugin, (GSourceFunc)find_port_support_idle, info); break; + + case MM_PLUGIN_SUPPORTS_PORT_DEFER_UNTIL_SUGGESTED: + /* We were told to defer until getting a suggested plugin, and we already + * got one here, so we're done. */ + if (info->suggested_plugin) { + mm_dbg ("(%s): (%s) support check finished, got suggested", + mm_plugin_get_name (MM_PLUGIN (info->suggested_plugin)), + info->name); + info->best_plugin = info->suggested_plugin; + info->current = NULL; + + /* Schedule checking support, which will end the operation */ + info->source_id = g_idle_add ((GSourceFunc)find_port_support_idle, + info); + } else { + mm_dbg ("(%s): (%s) deferring support check until result suggested", + mm_plugin_get_name (MM_PLUGIN (info->current->data)), + info->name); + /* Schedule checking support */ + info->source_id = g_timeout_add_seconds (SUPPORTS_DEFER_TIMEOUT_SECS, + (GSourceFunc)find_port_support_idle, + info); + } + break; } } @@ -673,4 +697,3 @@ mm_plugin_manager_class_init (MMPluginManagerClass *manager_class) /* Virtual methods */ object_class->finalize = finalize; } - diff --git a/src/mm-plugin.h b/src/mm-plugin.h index 369b6614..47cf8572 100644 --- a/src/mm-plugin.h +++ b/src/mm-plugin.h @@ -50,6 +50,7 @@ typedef void (*MMSupportsPortResultFunc) (MMPlugin *plugin, typedef enum { MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED = 0x0, MM_PLUGIN_SUPPORTS_PORT_DEFER, + MM_PLUGIN_SUPPORTS_PORT_DEFER_UNTIL_SUGGESTED, MM_PLUGIN_SUPPORTS_PORT_SUPPORTED } MMPluginSupportsResult; @@ -137,4 +138,3 @@ MMBaseModem *mm_plugin_grab_port (MMPlugin *plugin, GError **error); #endif /* MM_PLUGIN_H */ - |