From 8e110af6e1d7a0c235049abe2a4c15ae4f688a36 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 11 Jan 2012 16:33:02 +0100 Subject: huawei: Check for NDIS vs modem dial-up mode --- plugins/huawei.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'plugins/huawei.c') diff --git a/plugins/huawei.c b/plugins/huawei.c index 77f4eba7..5030e002 100644 --- a/plugins/huawei.c +++ b/plugins/huawei.c @@ -62,6 +62,7 @@ static const char *gcap_prefix[] = { "+GCAP:", NULL }; static const char *rfswitch_prefix[] = { "^RFSWITCH:", NULL }; static const char *sysinfo_prefix[] = { "^SYSINFO:", NULL }; static const char *ussdmode_prefix[] = { "^USSDMODE:", NULL }; +static const char *dialmode_prefix[] = { "^DIALMODE:", NULL }; static const char *cvoice_prefix[] = { "^CVOICE:", NULL }; enum { @@ -173,6 +174,40 @@ static void ussdmode_support_cb(gboolean ok, GAtResult *result, ussdmode_query_cb, data, NULL); } +static void dialmode_query_cb(gboolean ok, GAtResult *result, + gpointer user_data) +{ + //struct huawei_data *data = user_data; + GAtResultIter iter; + + if (!ok) + return; + + g_at_result_iter_init(&iter, result); + + if (!g_at_result_iter_next(&iter, "^DIALMODE:")) + return; +} + +static void dialmode_support_cb(gboolean ok, GAtResult *result, + gpointer user_data) +{ + struct huawei_data *data = user_data; + GAtResultIter iter; + + if (!ok) + return; + + g_at_result_iter_init(&iter, result); + + if (!g_at_result_iter_next(&iter, "^DIALMODE:")) + return; + + /* Query current NDIS mode */ + g_at_chat_send(data->pcui, "AT^DIALMODE?", dialmode_prefix, + dialmode_query_cb, data, NULL); +} + static void cvoice_query_cb(gboolean ok, GAtResult *result, gpointer user_data) { @@ -359,6 +394,10 @@ static void sysinfo_enable_cb(gboolean ok, GAtResult *result, g_at_chat_send(data->pcui, "AT^USSDMODE=?", ussdmode_prefix, ussdmode_support_cb, data, NULL); + /* Check NDIS mode support */ + g_at_chat_send(data->pcui, "AT^DIALMODE=?", dialmode_prefix, + dialmode_support_cb, data, NULL); + /* Check for voice support */ g_at_chat_send(data->pcui, "AT^CVOICE=?", cvoice_prefix, cvoice_support_cb, modem, NULL); -- cgit v1.2.3