mirror of git://git.sysmocom.de/ofono
atmodem: set the auth method for u-blox modems
This commit is contained in:
parent
cca3e085b3
commit
293c701e25
|
@ -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)
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue