Option (hso) modem and PAP
Hi,
I have been trying an Option modem with ofono recently. It took me a while to establish a connection because the APN we're using needs a username and password. Apparently Option swapped the username and password of the AT command AT$QCPDPP.
Also, it seems that some other Option modem uses AT_OPDPP instead of AT$QCPDPP, see http://www.pharscape.org/Quicksilver.html
I'll send two patches in reply to this message. The first one adds username and password optional parameters to test/create-context. And the second one swaps username and password for hso modem in PAP mode.
Benoît.
--
Une messagerie gratuite, garantie à vie et des services en plus, ça vous tente ? Je crée ma boîte mail www.laposte.net
PATCH 1/1 Set username and password with create-context
Add the possibility to set the username and the password with create-context, in complement of the APN.
---
test/create-context | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 deletions(-)
test/create-context +0 -0
@@ -27,10 +27,28 @@ for path, properties in modems:
context = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.ConnectionContext')
- 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
PATCH 1/1 hso : swap username and password for PAP
In reply to Benoit MoninThe parameters for the AT command AT$QCPDPP must be swapped for PAP in order to make to work with an Option modem. Tested with a GTM382 development kit. No idea about CHAP parameters.
---drivers/hsomodem/gprs-context.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hsomodem/gprs-context.c +0 -0
@@ -165,7 +165,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
Re: [PATCH] hso : swap username and password for PAP
Hi Benoit,
Quoted 13 lines · Benoit Monin
The parameters for the AT command AT$QCPDPP must be swapped for PAP in order to make to work with an Option modem. Tested with a GTM382 development kit. No idea about CHAP parameters.
---drivers/hsomodem/gprs-context.c| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)drivers/hsomodem/gprs-context.c +0
-0
drivers/hsomodem/gprs-context.c static void hso_gprs_activate_primary(struct ofono_gprs_context *gc, · line 171
Quoted 8 lines
drivers/hsomodem/gprs-context.c +1
-1@@ -165,7 +165,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);
Your patch submission seems mangled:
Applying: hso : swap username and password for PAP
fatal: corrupt patch at line 11
Patch failed at 0001 hso : swap username and password for PAP When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort".
I went ahead and fixed this for you.
Regards,
-Denis
Re: [PATCH] hso : swap username and password for PAP
Quoted 4 lines
De : "Denis Kenzior"
Your patch submission seems mangled:
[...]
Quoted 2 lines
I went ahead and fixed this for you.
Oops, sorry about that. Thanks for applying the patch.
Quoted 3 lines
Regards,
-Denis
Benoît.
--
Une messagerie gratuite, garantie à vie et des services en plus, ça vous tente ? Je crée ma boîte mail www.laposte.net