* Set username and password with create-context
2010-06-22 9:14 Option (hso) modem and PAP Benoit Monin
@ 2010-06-22 9:16 ` Benoit Monin
2010-06-22 9:16 ` hso : swap username and password for PAP Benoit Monin
1 sibling, 0 replies; 3+ messages in thread
From: Benoit Monin @ 2010-06-22 9:16 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1657 bytes --]
Add the possibility to set the username and the password
with create-context, in complement of the APN.
Signed-off-by: Benoît Monin
---
test/create-context | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/test/create-context b/test/create-context
index 4523c3a..c9ffeac 100755
--- a/test/create-context
+++ b/test/create-context
@@ -32,10 +32,28 @@ for path in properties["Modems"]:
context = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.PrimaryDataContext')
- try:
- context.SetProperty("AccessPointName", sys.argv[1])
- except IndexError:
- print "Usage: %s " % sys.argv[0]
+ if len(sys.argv) == 2:
+ AccessPointName = sys.argv[1]
+ Username = ""
+ Password = ""
+ elif len(sys.argv) == 3:
+ AccessPointName = sys.argv[1]
+ Username = ""
+ Password = sys.argv[2]
+ elif len(sys.argv) == 4:
+ AccessPointName = sys.argv[1]
+ Username = sys.argv[2]
+ Password = sys.argv[3]
+ else:
+ print "Usage:"
+ print "\t%s " % sys.argv[0]
+ print "\t%s
" % sys.argv[0]
+ print "\t%s
" % sys.argv[0]
exit(1)
- print "Setting APN of %s to %s" % (path, sys.argv[1])
+ context.SetProperty("AccessPointName", AccessPointName)
+ print "Setting APN of %s to \"%s\"" % (path, AccessPointName)
+ context.SetProperty("Username", Username)
+ print "Setting username of %s to \"%s\"" % (path, Username)
+ context.SetProperty("Password", Password)
+ print "Setting password of %s to \"%s\"" % (path, Password)
--
Une messagerie gratuite, garantie à vie et des services en plus, ça vous tente ?
Je crée ma boîte mail www.laposte.net
^ permalink raw reply related [flat|nested] 3+ messages in thread* hso : swap username and password for PAP
2010-06-22 9:14 Option (hso) modem and PAP Benoit Monin
2010-06-22 9:16 ` Set username and password with create-context Benoit Monin
@ 2010-06-22 9:16 ` Benoit Monin
1 sibling, 0 replies; 3+ messages in thread
From: Benoit Monin @ 2010-06-22 9:16 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1059 bytes --]
The parameters for the AT command AT$QCPDPP must be swapped for PAP in order
to make it work with an Option modem. Tested with a GTM382 development kit.
No idea about CHAP parameters, left unchanged.
Signed-off-by: Benoît Monin
---
drivers/hsomodem/gprs-context.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/hsomodem/gprs-context.c b/drivers/hsomodem/gprs-context.c
index 08c662f..87b6a09 100644
--- a/drivers/hsomodem/gprs-context.c
+++ b/drivers/hsomodem/gprs-context.c
@@ -166,7 +166,7 @@ static void hso_gprs_activate_primary(struct ofono_gprs_context *gc,
if (ctx->username[0] && ctx->password[0])
snprintf(buf, sizeof(buf), "AT$QCPDPP=%u,1,\"%s\",\"%s\"",
- ctx->cid, ctx->username, ctx->password);
+ ctx->cid, ctx->password, ctx->username);
else if (ctx->password[0])
snprintf(buf, sizeof(buf), "AT$QCPDPP=%u,2,,\"%s\"",
ctx->cid, ctx->password);
--
Une messagerie gratuite, garantie à vie et des services en plus, ça vous tente ?
Je crée ma boîte mail www.laposte.net
^ permalink raw reply related [flat|nested] 3+ messages in thread