All of lore.kernel.org
 help / color / mirror / Atom feed
* New test scripts ...
@ 2012-06-26  9:24 Jens Rehsack
  2012-06-26 14:56 ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Rehsack @ 2012-06-26  9:24 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 273 bytes --]

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

[-- Attachment #2: nw-properties.ksh --]
[-- Type: text/plain, Size: 1348 bytes --]

#!/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

[-- Attachment #3: sim-properties.ksh --]
[-- Type: text/plain, Size: 1247 bytes --]

#!/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

[-- Attachment #4: radio-properties.ksh --]
[-- Type: text/plain, Size: 1259 bytes --]

#!/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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: New test scripts ...
  2012-06-26  9:24 New test scripts Jens Rehsack
@ 2012-06-26 14:56 ` Marcel Holtmann
  2012-06-27 10:15   ` Jens Rehsack
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2012-06-26 14:56 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 534 bytes --]

Hi Jens,

> 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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: New test scripts ...
  2012-06-26 14:56 ` Marcel Holtmann
@ 2012-06-27 10:15   ` Jens Rehsack
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Rehsack @ 2012-06-27 10:15 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 880 bytes --]

On 26.06.2012 16:56, Marcel Holtmann wrote:
> Hi Jens,

Hi Marcel,

>> 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

> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-27 10:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-26  9:24 New test scripts Jens Rehsack
2012-06-26 14:56 ` Marcel Holtmann
2012-06-27 10:15   ` Jens Rehsack

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.