diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2013-10-30 20:18:11 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2013-10-30 20:18:11 +0100 |
commit | e9523a6abdead8669e21a1190209d962ab1cbf7d (patch) | |
tree | bf990600098e7fae1f31f859544f87944ae12538 | |
parent | 6a26ad7b530b112e694c406316934429039c7fb2 (diff) | |
download | ModemManager-e9523a6abdead8669e21a1190209d962ab1cbf7d.tar.gz |
huawei: clear only once the timeout to wait for the first interface
As soon as we get a match between the current interface being probed, and the
first expected interface to probe, clear the timeout. But this doesn't mean that
this interface being probed will be the correct one, so it may be the case that
we end up expecting a new first interface and probing another one.
With an example probably seen better...
Modem appears with interfaces 2, 3 and 4.
1. We first try to look for interface 0, which is not in the set:
1.1. Probing interfaces 2, 3 and 4 get deferred.
2. First-interface timeout happens because interface 0 doesn't appear, so we
switch to wait for interface 1:
2.1 Probing interfaces 2, 3 and 4 get deferred.
3. First-interface timeout happens because interface 1 doesn't appear, so we
switch to wait for interface 2:
3.1. We get a match on interface 2, which exists. We now remove the
first-interface timeout and start running the init sequence there.
3.2. Probing interfaces 3 and 4 get deferred.
4. Init sequence in interface 2 fails, because it is not an AT port, so we
switch to wait for interface 3:
3.1. We get a match on interface 3, which exists. We do *not* need to remove
now the first-interface timeout because this interface we are testing is
actually the second one which we tried.
So, just check whether the timeout exists or not, and if it exists remove it.
Yeah, this commit just fixes a warning at the end.
-rw-r--r-- | plugins/huawei/mm-plugin-huawei.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/huawei/mm-plugin-huawei.c b/plugins/huawei/mm-plugin-huawei.c index fb13fe778..524edb633 100644 --- a/plugins/huawei/mm-plugin-huawei.c +++ b/plugins/huawei/mm-plugin-huawei.c @@ -390,8 +390,10 @@ huawei_custom_init (MMPortProbe *probe, } /* We can run custom init in the first interface! clear the timeout as it is no longer needed */ - g_source_remove (fi_ctx->timeout_id); - fi_ctx->timeout_id = 0; + if (fi_ctx->timeout_id) { + g_source_remove (fi_ctx->timeout_id); + fi_ctx->timeout_id = 0; + } huawei_custom_init_step (ctx); } |