diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2013-11-20 18:31:39 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2014-02-13 13:41:09 +0100 |
commit | e684851698924e5b3872ac3adc93c2773ef910ee (patch) | |
tree | 8181f9df72ecae984341359f1f9c5024dd1ccf0c | |
parent | b28230411a3f47bbba71b905e3982575308f81f4 (diff) |
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.
-rw-r--r-- | plugins/huawei/mm-broadband-bearer-huawei.c | 24 |
1 files 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, |