From: Marcel Holtmann Date: Fri, 25 May 2012 10:29:59 +0000 (+0200) Subject: icera: Request USSD mode and firmware details X-Git-Tag: 1.7~42 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a5ae2e37df3925659b11cd0ecebb28fd2f0ce0ff;p=platform%2Fupstream%2Fofono.git icera: Request USSD mode and firmware details --- diff --git a/plugins/icera.c b/plugins/icera.c index 53fdf44..c283fcc 100644 --- a/plugins/icera.c +++ b/plugins/icera.c @@ -48,11 +48,13 @@ static const char *none_prefix[] = { NULL }; static const char *siminit_prefix[] = { "%ISIMINIT:", NULL }; +static const char *ussdmode_prefix[] = { "%IUSSDMODE:", NULL }; struct icera_data { GAtChat *chat; struct ofono_sim *sim; gboolean have_sim; + int ussdmode; }; static int icera_probe(struct ofono_modem *modem) @@ -132,6 +134,51 @@ static GAtChat *open_device(struct ofono_modem *modem, return chat; } +static void ussdmode_query(gboolean ok, GAtResult *result, + gpointer user_data) +{ + struct ofono_modem *modem = user_data; + struct icera_data *data = ofono_modem_get_data(modem); + GAtResultIter iter; + int mode; + + if (!ok) + return; + + g_at_result_iter_init(&iter, result); + + if (!g_at_result_iter_next(&iter, "%IUSSDMODE:")) + return; + + if (!g_at_result_iter_next_number(&iter, &mode)) + return; + + DBG("mode %d", mode); + + data->ussdmode = mode; +} + +static void ussdmode_support(gboolean ok, GAtResult *result, + gpointer user_data) +{ + struct ofono_modem *modem = user_data; + struct icera_data *data = ofono_modem_get_data(modem); + GAtResultIter iter; + + if (!ok) + return; + + g_at_result_iter_init(&iter, result); + + DBG("a"); + if (!g_at_result_iter_next(&iter, "%IUSSDMODE:")) + return; + + DBG("b"); + g_at_chat_send(data->chat, "AT%IUSSDMODE?", ussdmode_prefix, + ussdmode_query, modem, NULL); +} + static void icera_set_sim_state(struct icera_data *data, int state) { DBG("state %d", state); @@ -233,7 +280,7 @@ static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data) g_at_chat_send(data->chat, "AT%ISIMINIT", siminit_prefix, siminit_query, modem, NULL); - g_at_chat_send(data->chat, "AT*TSIMINS=1", none_prefix, + g_at_chat_send(data->chat, "AT%IAIRCRAFT?", none_prefix, NULL, NULL, NULL); } @@ -249,6 +296,12 @@ static int icera_enable(struct ofono_modem *modem) g_at_chat_send(data->chat, "ATE0 +CMEE=1", NULL, NULL, NULL, NULL); + g_at_chat_send(data->chat, "AT%IFWR", none_prefix, NULL, NULL, NULL); + g_at_chat_send(data->chat, "AT%ISWIN", none_prefix, NULL, NULL, NULL); + + g_at_chat_send(data->chat, "AT%IUSSDMODE=?", ussdmode_prefix, + ussdmode_support, modem, NULL); + g_at_chat_send(data->chat, "AT+CFUN=4", none_prefix, cfun_enable, modem, NULL);