[PATCH] ModemManager: Split the Samsung initialization sequence so that echoing is properly disabled



We were sometimes seeing the IMSI reported as "AT+CIMI\n\r\n\r31026..." because echoing was not always turned off at the point that the IMSI is requested. This patch fixes that by splitting the reset commands so that the second part of the command gets processed after the reset is complete.
(This wasn't always a problem because the initial IMSI request usually fails since the SIM is not yet powered up. With the right enable/disable sequences, however, the initial AT+CIMI would succeed, and be echoed into the returned value.)

    - Nathan

From fa69fc6d4019b909db77e387ab5c9a5765c85159 Mon Sep 17 00:00:00 2001
From: Nathan Williams <njw chromium org>
Date: Thu, 12 May 2011 15:23:33 -0400
Subject: [PATCH] Split the Samsung initialization sequence from "ATZ E0 V1" to "ATZ"
 and "ATE0 V1" - the modem is allowed to ignore the rest of the line
 after Z, so echoing was not being turned off, leading to getting
 "AT+CIMI\n\n" as part of the IMSI when it is retrieved at startup.

Change-Id: Icfd767174e779e472f8cde419acb163128e4715d
---
 plugins/mm-modem-samsung-gsm.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/plugins/mm-modem-samsung-gsm.c b/plugins/mm-modem-samsung-gsm.c
index 8b51ca8..6ee2e16 100755
--- a/plugins/mm-modem-samsung-gsm.c
+++ b/plugins/mm-modem-samsung-gsm.c
@@ -704,6 +704,21 @@ init_done (MMAtSerialPort *port,
 }
 
 static void
+init_reset_done (MMAtSerialPort *port,
+           GString *response,
+           GError *error,
+           gpointer user_data)
+{
+    MMCallbackInfo *info = (MMCallbackInfo *) user_data;
+    MMModemSamsungGsm *self = MM_MODEM_SAMSUNG_GSM (info->modem);
+
+    if (error)
+        mm_generic_gsm_enable_complete (MM_GENERIC_GSM (self), error, info);
+    else
+        mm_at_serial_port_queue_command (port, "E0 V1", 3, init_done, info);
+}
+
+static void
 do_enable (MMGenericGsm *modem, MMModemFn callback, gpointer user_data)
 {
     MMCallbackInfo *info;
@@ -713,7 +728,7 @@ do_enable (MMGenericGsm *modem, MMModemFn callback, gpointer user_data)
 
     primary = mm_generic_gsm_get_at_port (modem, MM_PORT_TYPE_PRIMARY);
     g_assert (primary);
-    mm_at_serial_port_queue_command (primary, "Z E0 V1", 3, init_done, info);
+    mm_at_serial_port_queue_command (primary, "Z", 3, init_reset_done, info);
 }
 
 static void
-- 
1.7.3.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]