From 16d4d541a41c4829c4e72602327b5157f4bb35cb Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 3 Dec 2008 13:34:33 +0100 Subject: [PATCH] Add script for setting a passphrase --- test/Makefile.am | 6 +++--- test/set-passphrase | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100755 test/set-passphrase diff --git a/test/Makefile.am b/test/Makefile.am index fe11939..e0be1bc 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 0000000..db39554 --- /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 " % (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]) -- 1.7.9.5