Christopher Wiley | 2f48d95 | 2013-02-22 09:51:47 -0800 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
| 3 | import dbus, flimflam, sys |
| 4 | |
| 5 | if (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 | |
| 11 | flim = flimflam.FlimFlam() |
| 12 | device = flim.FindElementByNameSubstring('Device', name) |
| 13 | if property_key in ["BgscanShortInterval", "ScanInterval" ]: |
| 14 | device.SetProperty(property_key, dbus.Int16(value)) |
| 15 | elif property_key in [ "BgscanSignalThreshold", ]: |
| 16 | device.SetProperty(property_key, int(value)) |
| 17 | elif property_key in ["Cellular.AllowRoaming", "Powered"]: |
| 18 | device.SetProperty(property_key, |
| 19 | dbus.Boolean(value.lower() in ("true", "1"))) |
| 20 | else: |
| 21 | device.SetProperty(property_key, value) |