From 15e99430363fcaf7d2a3be6afb7961d2e3f7e8b3 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 13 Mar 2012 18:20:01 +0100 Subject: plugin-base: avoid launching AT probing on new ports if the modem expects only one If we got an existing modem showing a new port, and the plugin handling that modem said that only one AT port was expected, we shouldn't be AT-probing it any more. --- src/mm-plugin-base.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mm-plugin-base.c b/src/mm-plugin-base.c index d7e49203..9fe3d6b9 100644 --- a/src/mm-plugin-base.c +++ b/src/mm-plugin-base.c @@ -680,7 +680,7 @@ supports_port (MMPlugin *plugin, } /* Build flags depending on what probing needed */ - probe_run_flags = 0; + probe_run_flags = MM_PORT_PROBE_NONE; if (priv->at) probe_run_flags |= MM_PORT_PROBE_AT; else if (priv->single_at) @@ -691,8 +691,24 @@ supports_port (MMPlugin *plugin, probe_run_flags |= (MM_PORT_PROBE_AT | MM_PORT_PROBE_AT_PRODUCT); if (priv->qcdm) probe_run_flags |= MM_PORT_PROBE_QCDM; + g_assert (probe_run_flags != MM_PORT_PROBE_NONE); + /* If a modem is already available and the plugin says that only one AT port is + * expected, check if we alredy got the single AT port. And if so, we know this + * port being probed won't be AT. */ + if (priv->single_at && + existing && + mm_base_modem_has_at_port (existing)) { + mm_dbg ("(%s) not setting up AT probing tasks for (%s,%s): " + "modem already has the expected single AT port", + priv->name, subsys, name); + + /* Assuming it won't be an AT port. We still run the probe anyway, in + * case we need to check for other port types (e.g. QCDM) */ + mm_port_probe_set_result_at (probe, FALSE); + } + /* Setup async call context */ ctx = g_new (PortProbeRunContext, 1); ctx->plugin = g_object_ref (self); -- cgit v1.2.3-70-g09d2