plugin-manager: new defer-until-suggested support check result handling
'net' ports will be supported as soon as there is another port reporting successful support.
This commit is contained in:
@@ -617,15 +617,18 @@ supports_port (MMPlugin *plugin,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Before launching any probing, check if the port is a net device (which
|
/* 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 (g_str_equal (subsys, "net")) {
|
||||||
/* If we already have a existing modem, then mark it as supported.
|
/* If we already have a existing modem, then mark it as supported.
|
||||||
* Otherwise, just defer a bit */
|
* Otherwise, just defer a bit */
|
||||||
g_simple_async_result_set_op_res_gpointer (async_result,
|
g_simple_async_result_set_op_res_gpointer (
|
||||||
GUINT_TO_POINTER ((existing ?
|
async_result,
|
||||||
MM_PLUGIN_SUPPORTS_PORT_SUPPORTED :
|
GUINT_TO_POINTER ((existing ?
|
||||||
MM_PLUGIN_SUPPORTS_PORT_DEFER)),
|
MM_PLUGIN_SUPPORTS_PORT_SUPPORTED :
|
||||||
NULL);
|
MM_PLUGIN_SUPPORTS_PORT_DEFER_UNTIL_SUGGESTED)),
|
||||||
|
NULL);
|
||||||
g_simple_async_result_complete_in_idle (async_result);
|
g_simple_async_result_complete_in_idle (async_result);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@@ -271,6 +271,30 @@ supports_port_ready_cb (MMPlugin *plugin,
|
|||||||
(GSourceFunc)find_port_support_idle,
|
(GSourceFunc)find_port_support_idle,
|
||||||
info);
|
info);
|
||||||
break;
|
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 */
|
/* Virtual methods */
|
||||||
object_class->finalize = finalize;
|
object_class->finalize = finalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -50,6 +50,7 @@ typedef void (*MMSupportsPortResultFunc) (MMPlugin *plugin,
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED = 0x0,
|
MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED = 0x0,
|
||||||
MM_PLUGIN_SUPPORTS_PORT_DEFER,
|
MM_PLUGIN_SUPPORTS_PORT_DEFER,
|
||||||
|
MM_PLUGIN_SUPPORTS_PORT_DEFER_UNTIL_SUGGESTED,
|
||||||
MM_PLUGIN_SUPPORTS_PORT_SUPPORTED
|
MM_PLUGIN_SUPPORTS_PORT_SUPPORTED
|
||||||
} MMPluginSupportsResult;
|
} MMPluginSupportsResult;
|
||||||
|
|
||||||
@@ -137,4 +138,3 @@ MMBaseModem *mm_plugin_grab_port (MMPlugin *plugin,
|
|||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
#endif /* MM_PLUGIN_H */
|
#endif /* MM_PLUGIN_H */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user