Skip to contentSkip to conversation

sim-poll: Count timeout from the moment STATUS is sent to modem.

PATCH In review Andrzej Zaborowski 1 participant 1 message May 7, 2010

lore
Share & tools
lore
#0 lore raw

PATCH v2 3/6 sim-poll: Count timeout from the moment STATUS is sent to modem.

---
 drivers/atmodem/sim-poll.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
drivers/atmodem/sim-poll.c +12 -5
index bd2caa6..111dce8 100644
@@ -198,20 +198,27 @@ static void at_csim_status_cb(gboolean ok, GAtResult *result,
 	sim_fetch_command(spd, response[len - 1]);
 }
 
-static gboolean sim_status_poll(gpointer user_data)
+static void at_csim_status_sent_cb(guint command_id, gpointer user_data)
 {
 	struct sim_poll_data *spd = user_data;
 
-	spd->poll_timeout = 0;
-
 	/* The SIM must respond in a given time frame which is of at
 	 * least 5 seconds in TS 11.11.  */
 	spd->status_timeout = g_timeout_add_seconds(5,
 			sim_status_timeout, spd);
+}
+
+static gboolean sim_status_poll(gpointer user_data)
+{
+	struct sim_poll_data *spd = user_data;
+
+	spd->poll_timeout = 0;
+	spd->status_timeout = -1;
 
 	/* Send STATUS */
-	spd->status_cmd = g_at_chat_send(spd->chat, "AT+CSIM=8,A0F200C0",
-			csim_prefix, at_csim_status_cb, spd);
+	spd->status_cmd = g_at_chat_send_full(spd->chat, "AT+CSIM=8,A0F200C0",
+			csim_prefix, at_csim_status_sent_cb, at_csim_status_cb,
+			spd, NULL);
 	if (spd->status_cmd == 0)
 		at_csim_status_cb(FALSE, NULL, spd);
 
Signature · 1 line
1.6.1