diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-13 18:20:01 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-16 14:53:25 +0100 |
commit | 15e99430363fcaf7d2a3be6afb7961d2e3f7e8b3 (patch) | |
tree | 549663ca103db02bf059bbafb182ab63b062395b | |
parent | 29f23f2a492d7743f19aa99c0f9dc1960160698c (diff) |
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.
-rw-r--r-- | src/mm-plugin-base.c | 18 |
1 files changed, 17 insertions, 1 deletions
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); |