1#!/usr/bin/python 2 3import dbus, flimflam, sys 4 5if (len(sys.argv) < 4): 6 print "Usage: %s <service-name> <property> <value>" % (sys.argv[0]) 7 sys.exit(1) 8 9(_, name, property_key, value) = sys.argv 10 11flim = flimflam.FlimFlam() 12service = flim.FindElementByPropertySubstring('Service', 'Name', name) 13 14if not service: 15 print "Could not find service: %s" % (sys.argv[1]) 16 sys.exit(1) 17 18if property_key in ["Priority"]: 19 service.SetProperty(property_key, int(value)) 20elif property_key in ["AutoConnect", "WiFi.HiddenSSID", "EAP.UseSystemCAs", 21 "SaveCredentials", "LinkMonitorDisable", "ManagedCredentials"]: 22 service.SetProperty(property_key, 23 dbus.Boolean(value.lower() in ("true", "1"))) 24else: 25 service.SetProperty(property_key, value) 26