Tizen 2.1 base
[platform/core/telephony/tel-plugin-imc.git] / packaging / 0009-s_modem-Add-XGENDATA-query-to-get-firmware-informati.patch
1 From a2b5d447eb38825e0af9e57dde07b6e941d48389 Mon Sep 17 00:00:00 2001
2 From: Philippe Nunes <philippe.nunes@linux.intel.com>
3 Date: Wed, 26 Sep 2012 17:26:42 +0200
4 Subject: [PATCH 09/23] s_modem: Add XGENDATA query to get firmware
5  information
6 Content-Type: text/plain; charset="utf-8"
7 Content-Transfer-Encoding: 8bit
8
9 ---
10  src/s_modem.c |   30 ++++++++++++++++++++++++++++++
11  1 file changed, 30 insertions(+)
12
13 diff --git a/src/s_modem.c b/src/s_modem.c
14 index 2c71457..22adfa3 100644
15 --- a/src/s_modem.c
16 +++ b/src/s_modem.c
17 @@ -275,6 +275,33 @@ static void on_response_set_flight_mode(TcorePending *p, int data_len, const voi
18         tcore_at_tok_free(tokens);
19  }
20  
21 +static void on_response_xgendata(TcorePending *p, int data_len, const void *data, void *user_data)
22 +{
23 +       const TcoreATResponse *resp = data;
24 +       GSList *tokens = NULL;
25 +       const char *line;
26 +
27 +       if (resp->success > 0) {
28 +               dbg("RESPONSE OK");
29 +               if (resp->lines) {
30 +                       line = (const char *) resp->lines->data;
31 +                       tokens = tcore_at_tok_new(line);
32 +                       if (g_slist_length(tokens) != 1) {
33 +                               msg("invalid message");
34 +                               goto OUT;
35 +                       }
36 +               }
37 +
38 +               dbg("XGENDATA = [%s]", g_slist_nth_data(tokens, 0));
39 +       }
40 +
41 +OUT:
42 +       if (tokens != NULL)
43 +               tcore_at_tok_free(tokens);
44 +
45 +       return;
46 +}
47 +
48  static void on_response_imei(TcorePending *p, int data_len, const void *data, void *user_data)
49  {
50         const TcoreATResponse *resp = data;
51 @@ -511,6 +538,9 @@ gboolean on_event_modem_power(TcoreAT *at, const char *line, TcorePlugin *p)
52         /* Get Version Number  */
53         prepare_and_send_pending_request(p, "modem", "AT+CGMR", NULL, TCORE_AT_SINGLELINE, on_response_version);
54  
55 +       /* Get XGENDATA info */
56 +       prepare_and_send_pending_request(p, "modem", "AT+XGENDATA", "+XGENDATA:", TCORE_AT_MULTILINE, on_response_xgendata);
57 +
58         tcore_modem_set_powered(o, TRUE);
59  
60         modem_power.state = MODEM_STATE_ONLINE;
61 -- 
62 1.7.10.4
63