summaryrefslogtreecommitdiffstats
path: root/drivers/atmodem
diff options
context:
space:
mode:
authorPhilip Paeps <philip@paeps.cx>2014-07-03 12:32:06 +0200
committerDenis Kenzior <denkenz@gmail.com>2014-07-08 08:52:25 -0500
commit293c701e25a6d67fbf9cb51c46983ee524e020d2 (patch)
treef8f71b865e9459fe60462a1d39f2649decf4924c /drivers/atmodem
parentcca3e085b34b67ecc7a71c831aeeedd597c7226a (diff)
downloadofono-293c701e25a6d67fbf9cb51c46983ee524e020d2.tar.bz2
atmodem: set the auth method for u-blox modems
Diffstat (limited to 'drivers/atmodem')
-rw-r--r--drivers/atmodem/gprs-context.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c
index be44443b..f6e6c2ef 100644
--- a/drivers/atmodem/gprs-context.c
+++ b/drivers/atmodem/gprs-context.c
@@ -282,9 +282,34 @@ static void at_gprs_activate_primary(struct ofono_gprs_context *gc,
len = snprintf(buf, sizeof(buf), "AT+CGDCONT=%u,\"IP\"", ctx->cid);
- if (ctx->apn)
- snprintf(buf + len, sizeof(buf) - len - 3, ",\"%s\"",
- ctx->apn);
+ if (ctx->apn) {
+ switch (gcd->vendor) {
+ case OFONO_VENDOR_UBLOX:
+ /*
+ * U-blox modems require a magic prefix to the APN to
+ * specify the authentication method to use in the
+ * network. See UBX-13002752 - R21.
+ *
+ * As the response of the read command omits this magic
+ * prefix, this is the least invasive place to set it.
+ */
+ switch (ctx->auth_method) {
+ case OFONO_GPRS_AUTH_METHOD_CHAP:
+ snprintf(buf + len, sizeof(buf) - len - 3,
+ ",\"CHAP:%s\"", ctx->apn);
+ break;
+ case OFONO_GPRS_AUTH_METHOD_PAP:
+ snprintf(buf + len, sizeof(buf) - len - 3,
+ ",\"PAP:%s\"", ctx->apn);
+ break;
+ }
+ break;
+ default:
+ snprintf(buf + len, sizeof(buf) - len - 3, ",\"%s\"",
+ ctx->apn);
+ break;
+ }
+ }
if (g_at_chat_send(gcd->chat, buf, none_prefix,
at_cgdcont_cb, gc, NULL) > 0)