6 if (len(sys.argv) < 4 and sys.argv[1] == "wifi"):
7 print "Usage: %s wifi [SSID] [passphrase]" % (sys.argv[0])
9 elif (len(sys.argv) < 2):
10 print "Usage: %s type" % (sys.argv[0])
12 bus = dbus.SystemBus()
14 manager = dbus.Interface(bus.get_object('net.connman', "/"),
15 'net.connman.Manager')
17 def technology_enable_tethering(path, tech_type, ssid, psk):
18 tech = dbus.Interface(bus.get_object("net.connman", path),
19 "net.connman.Technology")
21 properties = tech.GetProperties()
23 for key in properties.keys():
25 if properties[key] == tech_type:
27 tech.SetProperty("TetheringIdentifier",
30 tech.SetProperty("TetheringPassphrase",
32 print "Enabling %s tethering" % tech_type
33 tech.SetProperty("Tethering", dbus.Boolean(1))
39 properties = manager.GetProperties()
41 for key in properties.keys():
42 if key in ["Technologies"]:
43 for path in properties[key]:
44 if (len(sys.argv) == 4):
45 tech = technology_enable_tethering(path,
46 sys.argv[1], sys.argv[2], sys.argv[3])
48 tech = technology_enable_tethering(path,
55 print "Failed to enable %s tethering" % (sys.argv[1])