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
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
@@ -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
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 it work with an Option modem. Tested with a GTM382 development kit. No idea about CHAP parameters, left unchanged.
---drivers/hsomodem/gprs-context.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hsomodem/gprs-context.c +0 -0
@@ -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