2014-03-11 16:39:22 +00:00
|
|
|
#!/usr/bin/python3
|
2009-09-02 10:58:27 +00:00
|
|
|
|
|
|
|
import dbus
|
2010-08-18 22:47:14 +00:00
|
|
|
import sys
|
2009-09-02 10:58:27 +00:00
|
|
|
|
|
|
|
bus = dbus.SystemBus()
|
|
|
|
|
|
|
|
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
|
|
|
|
'org.ofono.Manager')
|
|
|
|
|
2010-09-09 19:37:37 +00:00
|
|
|
modems = manager.GetModems()
|
2009-09-02 10:58:27 +00:00
|
|
|
|
2010-09-09 19:37:37 +00:00
|
|
|
for path, properties in modems:
|
2014-03-11 16:39:18 +00:00
|
|
|
print("[ %s ]" % (path))
|
2009-09-02 10:58:27 +00:00
|
|
|
|
|
|
|
if "org.ofono.NetworkRegistration" not in properties["Interfaces"]:
|
|
|
|
continue
|
|
|
|
|
|
|
|
netreg = dbus.Interface(bus.get_object('org.ofono', path),
|
|
|
|
'org.ofono.NetworkRegistration')
|
|
|
|
|
2010-08-18 22:47:14 +00:00
|
|
|
if len(sys.argv) == 2 and sys.argv[1] == 'scan':
|
|
|
|
operators = netreg.Scan()
|
|
|
|
else:
|
|
|
|
operators = netreg.GetOperators()
|
2009-09-02 10:58:27 +00:00
|
|
|
|
2010-08-18 22:47:14 +00:00
|
|
|
for path, properties in operators:
|
2014-03-11 16:39:18 +00:00
|
|
|
print(" [ %s ]" % (path))
|
2009-09-02 10:58:27 +00:00
|
|
|
|
|
|
|
for key in properties.keys():
|
2009-11-18 10:52:39 +00:00
|
|
|
if key in ["Technologies"]:
|
|
|
|
val = ""
|
|
|
|
for i in properties[key]:
|
|
|
|
val += i + " "
|
|
|
|
else:
|
|
|
|
val = str(properties[key])
|
2014-03-11 16:39:18 +00:00
|
|
|
print(" %s = %s" % (key, val))
|
2010-08-18 22:47:14 +00:00
|
|
|
|
2014-03-11 16:39:18 +00:00
|
|
|
print('')
|