From 1d449943af34147ad7af8cd158a6fb1ae3a45312 Mon Sep 17 00:00:00 2001 From: Kalle Valo Date: Mon, 9 Aug 2010 17:22:31 +0300 Subject: [PATCH] Add test scripts to to lock and unlock pin --- Makefile.am | 4 +++- test/lock-pin | 27 +++++++++++++++++++++++++++ test/unlock-pin | 27 +++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100755 test/lock-pin create mode 100755 test/unlock-pin diff --git a/Makefile.am b/Makefile.am index 8d1d2c26..38210e23 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 00000000..a0b6e30c --- /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 00000000..4a05cd4e --- /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)