1 From 389f7a04eefccdec5f2597df0d6c836a0010b268 Mon Sep 17 00:00:00 2001
2 From: Philippe Nunes <philippe.nunes@linux.intel.com>
3 Date: Tue, 18 Sep 2012 17:47:49 +0200
4 Subject: [PATCH 02/23] s_modem: CGMR response parsing is compatible with IMC
6 Content-Type: text/plain; charset="utf-8"
7 Content-Transfer-Encoding: 8bit
10 src/s_modem.c | 21 ++++++++++++---------
11 1 file changed, 12 insertions(+), 9 deletions(-)
13 diff --git a/src/s_modem.c b/src/s_modem.c
14 index 88a06a7..edd1ca9 100644
17 @@ -360,20 +360,23 @@ static void on_response_version(TcorePending *p, int data_len, const void *data,
19 line = (const char *) resp->lines->data;
20 tokens = tcore_at_tok_new(line);
21 - if (g_slist_length(tokens) != 5) {
22 + if (g_slist_length(tokens) == 1) {
23 + swver = g_slist_nth_data(tokens, 0);
24 + dbg("version: sw=[%s]", swver);
25 + } else if (g_slist_length(tokens) == 5) {
26 + swver = g_slist_nth_data(tokens, 0);
27 + hwver = g_slist_nth_data(tokens, 1);
28 + caldate = g_slist_nth_data(tokens, 2);
29 + pcode = g_slist_nth_data(tokens, 3);
30 + id = g_slist_nth_data(tokens, 4);
32 + dbg("version: sw=[%s], hw=[%s], rf_cal=[%s], product_code=[%s], model_id=[%s]", swver, hwver, caldate, pcode, id);
34 msg("invalid message");
39 - swver = g_slist_nth_data(tokens, 0);
40 - hwver = g_slist_nth_data(tokens, 1);
41 - caldate = g_slist_nth_data(tokens, 2);
42 - pcode = g_slist_nth_data(tokens, 3);
43 - id = g_slist_nth_data(tokens, 4);
45 - dbg("version: sw=[%s], hw=[%s], rf_cal=[%s], product_code=[%s], model_id=[%s]", swver, hwver, caldate, pcode, id);
47 vi = calloc(sizeof(TelMiscVersionInformation), 1);
49 memcpy(vi->szSwVersion, swver, strlen(swver));