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.
This commit is contained in:
Aleksander Morgado
2013-10-30 20:18:11 +01:00
parent 6a26ad7b53
commit e9523a6abd
+4 -2
View File
@@ -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);
}