1#!/usr/bin/python 2 3import dbus, flimflam, sys 4 5if (len(sys.argv) < 4): 6 print "Usage: %s <device-name> <property> <value>" % (sys.argv[0]) 7 sys.exit(1) 8 9(_, name, property_key, value) = sys.argv 10 11flim = flimflam.FlimFlam() 12device = flim.FindElementByNameSubstring('Device', name) 13if property_key in ["BgscanShortInterval", "RoamThreshold", "ScanInterval" ]: 14 device.SetProperty(property_key, dbus.UInt16(value)) 15elif property_key in [ "BgscanSignalThreshold", ]: 16 device.SetProperty(property_key, dbus.Int32(value)) 17elif property_key in ["Cellular.AllowRoaming", "Powered"]: 18 device.SetProperty(property_key, 19 dbus.Boolean(value.lower() in ("true", "1"))) 20else: 21 device.SetProperty(property_key, value) 22