diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-12-03 13:34:33 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-12-03 13:34:33 +0100 |
commit | 16d4d541a41c4829c4e72602327b5157f4bb35cb (patch) | |
tree | 1a2a4d59e0943ae83e2205809c14952d393c204b /test | |
parent | b9d78ccae06676a1cc82b1555bc14fb6ecfcdae0 (diff) | |
download | connman-16d4d541a41c4829c4e72602327b5157f4bb35cb.tar.gz connman-16d4d541a41c4829c4e72602327b5157f4bb35cb.tar.bz2 connman-16d4d541a41c4829c4e72602327b5157f4bb35cb.zip |
Add script for setting a passphrase
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 6 | ||||
-rwxr-xr-x | test/set-passphrase | 31 |
2 files changed, 34 insertions, 3 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index fe11939d..e0be1bc4 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,7 +1,7 @@ EXTRA_DIST = list-profiles list-elements monitor-elements monitor-state \ - get-state select-network disable-network monitor-networks \ - enable-device disable-device start-scanning simple-agent \ - show-introspection test-compat test-supplicant + get-state set-passphrase select-network disable-network \ + monitor-networks enable-device disable-device start-scanning \ + simple-agent show-introspection test-compat test-supplicant MAINTAINERCLEANFILES = Makefile.in diff --git a/test/set-passphrase b/test/set-passphrase new file mode 100755 index 00000000..db39554f --- /dev/null +++ b/test/set-passphrase @@ -0,0 +1,31 @@ +#!/usr/bin/python + +import sys +import dbus + +if (len(sys.argv) < 3): + print "Usage: %s <network> <passphrase>" % (sys.argv[0]) + sys.exit(1) + +bus = dbus.SystemBus() + +manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"), + "org.moblin.connman.Manager") + +properties = manager.GetProperties() + +for path in properties["Devices"]: + device = dbus.Interface(bus.get_object("org.moblin.connman", path), + "org.moblin.connman.Device") + + properties = device.GetProperties() + + for path in properties["Networks"]: + network = dbus.Interface(bus.get_object("org.moblin.connman", path), + "org.moblin.connman.Network") + + properties = network.GetProperties() + + if (properties["WiFi.Name"] == sys.argv[1]): + print "Setting passphrase for %s" % (path) + network.SetProperty("WiFi.Passphrase", sys.argv[2]) |