All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add test scripts to to lock and unlock pin
@ 2010-08-09 14:22 Kalle Valo
  2010-08-09 15:00 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Kalle Valo @ 2010-08-09 14:22 UTC (permalink / raw)
  To: ofono

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


---
 Makefile.am     |    4 +++-
 test/lock-pin   |   27 +++++++++++++++++++++++++++
 test/unlock-pin |   27 +++++++++++++++++++++++++++
 3 files changed, 57 insertions(+), 1 deletions(-)
 create mode 100755 test/lock-pin
 create mode 100755 test/unlock-pin

diff --git a/Makefile.am b/Makefile.am
index 8d1d2c2..38210e2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -344,7 +344,9 @@ test_scripts = test/activate-context \
 		test/set-use-sms-reports \
 		test/set-cbs-topics \
 		test/enable-cbs \
-		test/propose-scan
+		test/propose-scan \
+		test/lock-pin \
+		test/unlock-pin
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/test/lock-pin b/test/lock-pin
new file mode 100755
index 0000000..a0b6e30
--- /dev/null
+++ b/test/lock-pin
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+
+import dbus
+import sys
+
+bus = dbus.SystemBus()
+
+if len(sys.argv) == 4:
+	path = sys.argv[1]
+	pin_type = sys.argv[2]
+	pin = sys.argv[3]
+elif len(sys.argv) == 3:
+	manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+				 'org.ofono.Manager')
+	properties = manager.GetProperties()
+	path = properties["Modems"][0]
+	pin_type = sys.argv[1]
+	pin = sys.argv[2]
+else:
+	print "%s [PATH] pin_type pin" % (sys.argv[0])
+	sys.exit(0)
+
+print "Lock %s %s for modem %s..." % (pin_type, pin, path)
+
+simmanager = dbus.Interface(bus.get_object('org.ofono', path),
+			    'org.ofono.SimManager')
+simmanager.LockPin(pin_type, pin)
diff --git a/test/unlock-pin b/test/unlock-pin
new file mode 100755
index 0000000..4a05cd4
--- /dev/null
+++ b/test/unlock-pin
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+
+import dbus
+import sys
+
+bus = dbus.SystemBus()
+
+if len(sys.argv) == 4:
+	path = sys.argv[1]
+	pin_type = sys.argv[2]
+	pin = sys.argv[3]
+elif len(sys.argv) == 3:
+	manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+				 'org.ofono.Manager')
+	properties = manager.GetProperties()
+	path = properties["Modems"][0]
+	pin_type = sys.argv[1]
+	pin = sys.argv[2]
+else:
+	print "%s [PATH] pin_type pin" % (sys.argv[0])
+	sys.exit(0)
+
+print "Unlock %s %s for modem %s..." % (pin_type, pin, path)
+
+simmanager = dbus.Interface(bus.get_object('org.ofono', path),
+			    'org.ofono.SimManager')
+simmanager.UnlockPin(pin_type, pin)


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

end of thread, other threads:[~2010-08-09 15:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-09 14:22 [PATCH] Add test scripts to to lock and unlock pin Kalle Valo
2010-08-09 15:00 ` Denis Kenzior

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.