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.
This commit is contained in:
Aleksander Morgado
2013-11-20 18:31:39 +01:00
parent b28230411a
commit e684851698

View File

@@ -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,