mirror of git://git.sysmocom.de/ofono
Add test scripts to to lock and unlock pin
This commit is contained in:
parent
6556eda51c
commit
1d449943af
|
@ -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
|
||||
|
|
|
@ -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)
|
|
@ -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)
|
Loading…
Reference in New Issue