mirror of git://git.sysmocom.de/ofono
Improve GPRS test scripts
Catch some errors and add a script for removing contexts.
This commit is contained in:
parent
144b30ac6d
commit
1e75518c30
|
@ -35,4 +35,8 @@ for path in properties["Modems"]:
|
||||||
context = dbus.Interface(bus.get_object('org.ofono', path),
|
context = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.PrimaryDataContext')
|
'org.ofono.PrimaryDataContext')
|
||||||
|
|
||||||
context.SetProperty("Active", dbus.Boolean(1))
|
try:
|
||||||
|
context.SetProperty("Active", dbus.Boolean(1))
|
||||||
|
except dbus.DBusException, e:
|
||||||
|
print "Error activating %s: %s" % (path, str(e))
|
||||||
|
exit(2)
|
||||||
|
|
|
@ -32,6 +32,10 @@ for path in properties["Modems"]:
|
||||||
context = dbus.Interface(bus.get_object('org.ofono', path),
|
context = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.PrimaryDataContext')
|
'org.ofono.PrimaryDataContext')
|
||||||
|
|
||||||
context.SetProperty("AccessPointName", sys.argv[1])
|
try:
|
||||||
|
context.SetProperty("AccessPointName", sys.argv[1])
|
||||||
|
except IndexError:
|
||||||
|
print "Usage: %s <apn_name>" % sys.argv[0]
|
||||||
|
exit(1)
|
||||||
|
|
||||||
print "Setting APN of %s to %s" % (path, sys.argv[1])
|
print "Setting APN of %s to %s" % (path, sys.argv[1])
|
||||||
|
|
|
@ -33,4 +33,8 @@ for path in properties["Modems"]:
|
||||||
context = dbus.Interface(bus.get_object('org.ofono', path),
|
context = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.PrimaryDataContext')
|
'org.ofono.PrimaryDataContext')
|
||||||
|
|
||||||
context.SetProperty("Active", dbus.Boolean(0))
|
try:
|
||||||
|
context.SetProperty("Active", dbus.Boolean(0))
|
||||||
|
except dbus.DBusException, e:
|
||||||
|
print "Error activating %s: %s" % (path, str(e))
|
||||||
|
exit(2)
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import dbus
|
||||||
|
|
||||||
|
bus = dbus.SystemBus()
|
||||||
|
|
||||||
|
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
|
||||||
|
'org.ofono.Manager')
|
||||||
|
|
||||||
|
properties = manager.GetProperties()
|
||||||
|
|
||||||
|
for path in properties["Modems"]:
|
||||||
|
modem = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
|
'org.ofono.Modem')
|
||||||
|
|
||||||
|
properties = modem.GetProperties()
|
||||||
|
|
||||||
|
if "org.ofono.DataConnectionManager" not in properties["Interfaces"]:
|
||||||
|
continue
|
||||||
|
|
||||||
|
connmgr = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
|
'org.ofono.DataConnectionManager')
|
||||||
|
|
||||||
|
properties = connmgr.GetProperties()
|
||||||
|
|
||||||
|
for path in properties["PrimaryContexts"]:
|
||||||
|
connmgr.RemoveContext(path)
|
||||||
|
print"Removed: [ %s ]" % (path)
|
Loading…
Reference in New Issue