huawei: do not set timer more than once
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Wed, 19 Jan 2011 13:07:43 +0000 (11:07 -0200)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 19 Jan 2011 13:21:29 +0000 (14:21 +0100)
If a "^SYSINFO" arrives after the timer for query_sim_locked() has been
set up, it'd would set a new timer, signaling a sim state change more
than once.

plugins/huawei.c

index d6a9d68..b4b7436 100644 (file)
@@ -289,7 +289,8 @@ static void sysinfo_cb(gboolean ok, GAtResult *result, gpointer user_data)
                data->sim_poll_timeout = g_timeout_add_seconds(2,
                                                                query_sim_state,
                                                                modem);
-       } else if (sim_state == HUAWEI_SIM_STATE_INVALID_OR_LOCKED) {
+       } else if (sim_state == HUAWEI_SIM_STATE_INVALID_OR_LOCKED &&
+                                               !data->sim_poll_timeout) {
                data->sim_poll_timeout = g_timeout_add_seconds(2,
                                                                query_sim_locked,
                                                                modem);