Add support for setting manual DNS server configuration
[platform/upstream/connman.git] / test / disable-device
1 #!/usr/bin/python
2
3 import sys
4 import dbus
5
6 if (len(sys.argv) < 2):
7         print "Usage: %s <device>" % (sys.argv[0])
8         sys.exit(1)
9
10 bus = dbus.SystemBus()
11
12 manager = dbus.Interface(bus.get_object('org.moblin.connman', "/"),
13                                         'org.moblin.connman.Manager')
14
15 properties = manager.GetProperties()
16
17 for path in properties["Technologies"]:
18         technology = dbus.Interface(bus.get_object("org.moblin.connman", path),
19                                                 "org.moblin.connman.Technology")
20
21         properties = technology.GetProperties()
22
23         for path in properties["Devices"]:
24                 device = dbus.Interface(bus.get_object('org.moblin.connman', path),
25                                                         'org.moblin.connman.Device')
26
27                 properties = device.GetProperties()
28
29                 if "Interface" not in properties.keys():
30                         continue
31
32                 if properties["Interface"] != sys.argv[1]:
33                         continue
34
35                 print "Disabling device %s" % (path)
36
37                 device.SetProperty("Powered", dbus.Boolean(0));