blob: f9c335fd7583ce35cc19a84d55a0f14850d3412e [file] [log] [blame]
Christopher Wiley2f48d952013-02-22 09:51:47 -08001#!/usr/bin/python
2
3import dbus
4import flimflam
5import sys
6
7if len(sys.argv) < 2:
8 print "Usage: %s <GUID> [<property> <value>]" % (sys.argv[0])
9 sys.exit(1)
10
11print "Attempting to configure service %s" % (sys.argv[1])
12
13flim = flimflam.FlimFlam(dbus.SystemBus())
14
15params = { "GUID" : sys.argv[1] }
16argv = sys.argv[2:]
17while argv:
18 property_key = argv[0]
19 value = argv[1]
20 if property_key in ["Priority"]:
21 params[property_key] = int(value)
22 elif property_key in ["AutoConnect", "WiFi.HiddenSSID", "EAP.UseSystemCAS",
23 "SaveCredentials"]:
24 params[property_key] = dbus.Boolean(value.lower() in ("true", "1"))
25 else:
26 params[property_key] = value
27
28 argv = argv[2:]
29
30service = flim.GetService(params)
31properties = service.GetProperties(utf8_strings = True)
32
33print "[ %s ]" % (service.object_path)
34
35for key in properties.keys():
36 print " %s = %s" % \
37 (key, flimflam.convert_dbus_value(properties[key], 4))
38
39print