s_modem: CGMR response parsing is compatible with IMC PR3 modem
authorPhilippe Nunes <philippe.nunes@linux.intel.com>
Tue, 18 Sep 2012 15:47:49 +0000 (17:47 +0200)
committerwootak.jung <wootak.jung@samsung.com>
Sun, 24 Mar 2013 07:46:41 +0000 (16:46 +0900)
Change-Id: I802942b214e458c1e025dec20420105a505dfae6

src/s_modem.c

index 81bdec1..530db2f 100644 (file)
@@ -328,20 +328,23 @@ static void on_response_version(TcorePending *p, int data_len, const void *data,
                if (resp->lines) {
                        line = (const char *) resp->lines->data;
                        tokens = tcore_at_tok_new(line);
-                       if (g_slist_length(tokens) != 5) {
+                       if (g_slist_length(tokens) == 1) {
+                               swver = g_slist_nth_data(tokens, 0);
+                               dbg("version: sw=[%s]", swver);
+                       } else if (g_slist_length(tokens) == 5) {
+                               swver = g_slist_nth_data(tokens, 0);
+                               hwver = g_slist_nth_data(tokens, 1);
+                               caldate = g_slist_nth_data(tokens, 2);
+                               pcode = g_slist_nth_data(tokens, 3);
+                               id = g_slist_nth_data(tokens, 4);
+
+                               dbg("version: sw=[%s], hw=[%s], rf_cal=[%s], product_code=[%s], model_id=[%s]", swver, hwver, caldate, pcode, id);
+                       } else {
                                msg("invalid message");
                                goto OUT;
                        }
                }
 
-               swver = g_slist_nth_data(tokens, 0);
-               hwver = g_slist_nth_data(tokens, 1);
-               caldate = g_slist_nth_data(tokens, 2);
-               pcode = g_slist_nth_data(tokens, 3);
-               id = g_slist_nth_data(tokens, 4);
-
-               dbg("version: sw=[%s], hw=[%s], rf_cal=[%s], product_code=[%s], model_id=[%s]", swver, hwver, caldate, pcode, id);
-
                vi = calloc(sizeof(TelMiscVersionInformation), 1);
                if (NULL != swver)
                        memcpy(vi->szSwVersion, swver, strlen(swver));