From e684851698924e5b3872ac3adc93c2773ef910ee Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 20 Nov 2013 18:31:39 +0100 Subject: [PATCH] huawei: use shortened version of NDISDUP when possible Adds support for the Huawei E3276 by sending the shortened form of the AT^NDISDUP command where possible, as the E3276 fails with an '+CME ERROR: Incorrect parameters' if encoded_auth is set to 0. This behaviour is slightly different to the E1820 and K4605 (E372) which will happily establish a connection with encoded_auth set to 0, 1 or 2. --- plugins/huawei/mm-broadband-bearer-huawei.c | 24 ++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/plugins/huawei/mm-broadband-bearer-huawei.c b/plugins/huawei/mm-broadband-bearer-huawei.c index a23d95cf..2f365d89 100644 --- a/plugins/huawei/mm-broadband-bearer-huawei.c +++ b/plugins/huawei/mm-broadband-bearer-huawei.c @@ -285,11 +285,25 @@ connect_3gpp_context_step (Connect3gppContext *ctx) auth = mm_bearer_properties_get_allowed_auth (mm_bearer_peek_config (MM_BEARER (ctx->self))); encoded_auth = huawei_parse_auth_type (auth); - command = g_strdup_printf ("AT^NDISDUP=1,1,\"%s\",\"%s\",\"%s\",%d", - apn == NULL ? "" : apn, - user == NULL ? "" : user, - passwd == NULL ? "" : passwd, - encoded_auth == MM_BEARER_HUAWEI_AUTH_UNKNOWN ? MM_BEARER_HUAWEI_AUTH_NONE : encoded_auth); + /* Default to no authentication if not specified */ + if ((encoded_auth = huawei_parse_auth_type (auth)) == MM_BEARER_HUAWEI_AUTH_UNKNOWN) + encoded_auth = MM_BEARER_HUAWEI_AUTH_NONE; + + if (!user && !passwd) + command = g_strdup_printf ("AT^NDISDUP=1,1,\"%s\"", + apn == NULL ? "" : apn); + else if (encoded_auth == MM_BEARER_HUAWEI_AUTH_NONE) + command = g_strdup_printf ("AT^NDISDUP=1,1,\"%s\",\"%s\",\"%s\"", + apn == NULL ? "" : apn, + user == NULL ? "" : user, + passwd == NULL ? "" : passwd); + else + command = g_strdup_printf ("AT^NDISDUP=1,1,\"%s\",\"%s\",\"%s\",%d", + apn == NULL ? "" : apn, + user == NULL ? "" : user, + passwd == NULL ? "" : passwd, + encoded_auth); + mm_base_modem_at_command_full (ctx->modem, ctx->primary, command,