aboutsummaryrefslogtreecommitdiff
path: root/src/mm-plugin-base.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@gnu.org>2011-09-19 19:23:52 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:14:21 +0100
commit1e6b29bcca17c64818c1c49a1694b6caffde1611 (patch)
tree0cd0f303d2cbb38d8e32e1c6e6da24172ec54bf8 /src/mm-plugin-base.c
parentd9b2b6f8ec450dbbdf2f738ab26ee78d357d2034 (diff)
plugin-base: clear internally tracked probe if port unsupported
If the port is supported by the plugin, leave the probe in the internal HT until the port gets grabbed afterwards.
Diffstat (limited to 'src/mm-plugin-base.c')
-rw-r--r--src/mm-plugin-base.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/mm-plugin-base.c b/src/mm-plugin-base.c
index 3bc0ac0c..f26e76c5 100644
--- a/src/mm-plugin-base.c
+++ b/src/mm-plugin-base.c
@@ -480,6 +480,7 @@ port_probe_run_ready (MMPortProbe *probe,
PortProbeRunContext *ctx)
{
GError *error = NULL;
+ gboolean keep_probe = FALSE;
if (!mm_port_probe_run_finish (probe, probe_result, &error)) {
/* Probing failed */
@@ -488,10 +489,16 @@ port_probe_run_ready (MMPortProbe *probe,
/* Probing succeeded */
MMPluginSupportsResult supports_result;
- supports_result = (apply_post_probing_filters (ctx->plugin,
- probe) ?
- MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED :
- MM_PLUGIN_SUPPORTS_PORT_SUPPORTED);
+ if (!apply_post_probing_filters (ctx->plugin, probe)) {
+ /* Port is supported! Leave it in the internal HT until port gets
+ * grabbed. */
+ supports_result = MM_PLUGIN_SUPPORTS_PORT_SUPPORTED;
+ keep_probe = TRUE;
+ } else {
+ /* Unsupported port, remove from internal tracking HT */
+ supports_result = MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED;
+ }
+
g_simple_async_result_set_op_res_gpointer (ctx->result,
GUINT_TO_POINTER (supports_result),
NULL);
@@ -500,6 +507,17 @@ port_probe_run_ready (MMPortProbe *probe,
/* Complete the async supports port request */
g_simple_async_result_complete_in_idle (ctx->result);
+ /* If no longer needed, Remove probe from internal HT */
+ if (!keep_probe) {
+ MMPluginBasePrivate *priv = MM_PLUGIN_BASE_GET_PRIVATE (ctx->plugin);
+ gchar *key;
+
+ key = get_key (mm_port_probe_get_port_subsys (probe),
+ mm_port_probe_get_port_name (probe));
+ g_hash_table_remove (priv->tasks, key);
+ g_free (key);
+ }
+
g_object_unref (ctx->result);
g_object_unref (ctx->plugin);
g_free (ctx);