Add scripts for enabling/disabling devices
authorMarcel Holtmann <marcel@holtmann.org>
Tue, 7 Oct 2008 12:36:57 +0000 (14:36 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 7 Oct 2008 12:36:57 +0000 (14:36 +0200)
test/Makefile.am
test/disable-device [new file with mode: 0755]
test/enable-device [new file with mode: 0755]

index bcc9e5d..fe11939 100644 (file)
@@ -1,7 +1,7 @@
 
 EXTRA_DIST = list-profiles list-elements monitor-elements monitor-state \
                get-state select-network disable-network monitor-networks \
-               start-scanning simple-agent \
+               enable-device disable-device start-scanning simple-agent \
                show-introspection test-compat test-supplicant
 
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/test/disable-device b/test/disable-device
new file mode 100755 (executable)
index 0000000..ac55e77
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/python
+
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.moblin.connman', "/"),
+                                       'org.moblin.connman.Manager')
+
+elements = manager.ListElements()
+
+for path in elements:
+       element = dbus.Interface(bus.get_object('org.moblin.connman', path),
+                                               'org.moblin.connman.Element')
+
+       properties = element.GetProperties()
+
+       if (properties["Type"] != "device"):
+               continue
+
+       print "[ %s ]" % (path)
+
+       element.Disable()
diff --git a/test/enable-device b/test/enable-device
new file mode 100755 (executable)
index 0000000..55bd1f1
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/python
+
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.moblin.connman', "/"),
+                                       'org.moblin.connman.Manager')
+
+elements = manager.ListElements()
+
+for path in elements:
+       element = dbus.Interface(bus.get_object('org.moblin.connman', path),
+                                               'org.moblin.connman.Element')
+
+       properties = element.GetProperties()
+
+       if (properties["Type"] != "device"):
+               continue
+
+       print "[ %s ]" % (path)
+
+       element.Enable()