#!/usr/bin/python import dbus, flimflam, sys if (len(sys.argv) < 2): print "Usage: %s " % (sys.argv[0]) sys.exit(1) (_, name) = sys.argv flim = flimflam.FlimFlam(dbus.SystemBus()) device = flim.FindElementByNameSubstring('Device', name) if device is None: device = flim.FindElementByPropertySubstring('Device', 'Interface', name) print "Disabling device %s" % (device.object_path) # Shill uses the Disable method, flimflam uses a SetProperty call try: device.Disable() except dbus.DBusException, error: device.SetProperty("Powered", dbus.Boolean(0))