New test scripts ...
Hi all,
for personal requirements (debugging) I added 3 simple scripts (attached) to dump the properties of specific modem interfaces.
Shall I send patches for them or are they useless for the project? (For the records: I don't mind either)
Best regards,
Jens
#!/usr/bin/python
# from dbus import SystemBus, Interface, DBusException, UInt32, Int32, UInt64, Int64, Boolean import sys import dbus
def dedbustype(v):
if isinstance(v, bool) or isinstance(v, dbus.Boolean):
return bool(v)
elif isinstance(v, float):
return float(v)
elif isinstance(v, int) or isinstance(v, dbus.Int64) or isinstance(v, dbus.UInt64) or isinstance(v, dbus.Int32) or isinstance(v, dbus.UInt32):
return int(v)
elif isinstance(v, basestring):
return unicode(v)
elif isinstance(v, dict):
return dict([(str(n), dedbustype(m), ) for n, m in v.items()]) # use strings for names to allow **
elif isinstance(v, list) or isinstance(v, tuple):
return [dedbustype(m) for m in v]
else:
raise Exception('unsupported type %s'% type(v))
bus = dbus.SystemBus()
if len(sys.argv) == 2:
path = sys.argv[1]
elif len(sys.argv) == 1:
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
'org.ofono.Manager')
modems = manager.GetModems()
path = modems[0][0]
else:
print "%s [PATH]" % (sys.argv[0])
sys.exit(0)nwmanager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.NetworkRegistration')
properties = nwmanager.GetProperties()dd_p = dedbustype(properties)
print '--- nwreg_properties', dd_p
operators = nwmanager.GetOperators()dd_o = dedbustype(operators)
print '--- nwreg_operators', dd_o
#!/usr/bin/python
# from dbus import SystemBus, Interface, DBusException, UInt32, Int32, UInt64, Int64, Boolean import sys import dbus
def dedbustype(v):
if isinstance(v, bool) or isinstance(v, dbus.Boolean):
return bool(v)
elif isinstance(v, float):
return float(v)
elif isinstance(v, int) or isinstance(v, dbus.Int64) or isinstance(v, dbus.UInt64) or isinstance(v, dbus.Int32) or isinstance(v, dbus.UInt32):
return int(v)
elif isinstance(v, basestring):
return unicode(v)
elif isinstance(v, dict):
return dict([(str(n), dedbustype(m), ) for n, m in v.items()]) # use strings for names to allow **
elif isinstance(v, list) or isinstance(v, tuple):
return [dedbustype(m) for m in v]
else:
raise Exception('unsupported type %s'% type(v))
bus = dbus.SystemBus()
if len(sys.argv) == 2:
path = sys.argv[1]
elif len(sys.argv) == 1:
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
'org.ofono.Manager')
modems = manager.GetModems()
path = modems[0][0]
else:
print "%s [PATH]" % (sys.argv[0])
sys.exit(0)simmanager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.SimManager')
properties = simmanager.GetProperties()dd_p = dedbustype(properties)
print '--- sim_manager_properties', dd_p
#!/usr/bin/python
# from dbus import SystemBus, Interface, DBusException, UInt32, Int32, UInt64, Int64, Boolean import sys import dbus
def dedbustype(v):
if isinstance(v, bool) or isinstance(v, dbus.Boolean):
return bool(v)
elif isinstance(v, float):
return float(v)
elif isinstance(v, int) or isinstance(v, dbus.Int64) or isinstance(v, dbus.UInt64) or isinstance(v, dbus.Int32) or isinstance(v, dbus.UInt32):
return int(v)
elif isinstance(v, basestring):
return unicode(v)
elif isinstance(v, dict):
return dict([(str(n), dedbustype(m), ) for n, m in v.items()]) # use strings for names to allow **
elif isinstance(v, list) or isinstance(v, tuple):
return [dedbustype(m) for m in v]
else:
raise Exception('unsupported type %s'% type(v))
bus = dbus.SystemBus()
if len(sys.argv) == 2:
path = sys.argv[1]
elif len(sys.argv) == 1:
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
'org.ofono.Manager')
modems = manager.GetModems()
path = modems[0][0]
else:
print "%s [PATH]" % (sys.argv[0])
sys.exit(0)radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.RadioSettings')
properties = radiosettings.GetProperties()dd_r = dedbustype(properties)
print '--- radio_settings_properties', dd_r
Hi Jens,
Quoted 5 lines
for personal requirements (debugging) I added 3 simple scripts (attached) to dump the properties of specific modem interfaces.
Shall I send patches for them or are they useless for the project? (For the records: I don't mind either)
sending patches would be better. Especially since you might wanna have them added to Makefile.am as well.
As a note, have you considered creating one script with different command line options? Our script collection is getting kinda big ;)
Regards
Marcel
Quoted 1 line · Marcel Holtmann
Hi Jens,
Hi Marcel,
Quoted 8 lines
Quoted 5 lines
for personal requirements (debugging) I added 3 simple scripts (attached) to dump the properties of specific modem interfaces.
Shall I send patches for them or are they useless for the project? (For the records: I don't mind either)
sending patches would be better. Especially since you might wanna have them added to Makefile.am as well.
I just wanted to know if it's worth (for them and for future), ... scheduling prepare the patches
Quoted 2 lines
As a note, have you considered creating one script with different command line options? Our script collection is getting kinda big ;)
No, I didn't - to keep it easy (and I don't know how to do that in Python). For universal access with CLI I'd blow up the announced Net::Radio::oFono Perl5 module :)
Best regards,
Jens