summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-10-26 22:50:00 +0200
committerMarcel Holtmann <marcel@holtmann.org>2010-10-26 22:50:00 +0200
commit21a6a00646766c4751108878d18eaadc5306116c (patch)
treef5946b205a4715b86258fbc9656905d2444f844e
parent1519c1823ed2e2ed2aafcc4fa9443d1ee573beed (diff)
downloadofono-21a6a00646766c4751108878d18eaadc5306116c.tar.bz2
ifxmodem: Add support GPRS contexts with username and password
-rw-r--r--drivers/ifxmodem/gprs-context.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/ifxmodem/gprs-context.c b/drivers/ifxmodem/gprs-context.c
index 17a40528..b059f4ed 100644
--- a/drivers/ifxmodem/gprs-context.c
+++ b/drivers/ifxmodem/gprs-context.c
@@ -270,7 +270,7 @@ static void setup_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_gprs_context *gc = user_data;
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
- char buf[64];
+ char buf[128];
if (!ok) {
ofono_error("Failed to setup context");
@@ -278,14 +278,25 @@ static void setup_cb(gboolean ok, GAtResult *result, gpointer user_data)
return;
}
+ if (gcd->username[0] && gcd->password[0])
+ sprintf(buf, "AT+XGAUTH=%u,1,\"%s\",\"%s\"",
+ gcd->active_context, gcd->username, gcd->password);
+ else
+ sprintf(buf, "AT+XGAUTH=%u,0,\"\",\"\"", gcd->active_context);
+
+ if (g_at_chat_send(gcd->chat, buf, none_prefix, NULL, NULL, NULL) == 0)
+ goto error;
+
sprintf(buf, "AT+XDNS=%u,1", gcd->active_context);
- g_at_chat_send(gcd->chat, buf, none_prefix, NULL, NULL, NULL);
+ if (g_at_chat_send(gcd->chat, buf, none_prefix, NULL, NULL, NULL) == 0)
+ goto error;
sprintf(buf, "AT+CGACT=1,%u", gcd->active_context);
if (g_at_chat_send(gcd->chat, buf, none_prefix,
activate_cb, gc, NULL) > 0)
return;
+error:
failed_setup(gc, NULL, FALSE);
}