set-mode (448B)
1 #!/usr/bin/python3 2 3 import dbus 4 import sys 5 6 if len(sys.argv) != 3: 7 print('Usage: %s <device> <mode>' % sys.argv[0]) 8 exit(1) 9 10 if sys.argv[2] not in ['station', 'ap', 'ad-hoc']: 11 print('<mode> must be station, ap or ad-hoc') 12 exit(1) 13 14 bus = dbus.SystemBus() 15 device = dbus.Interface(bus.get_object('net.connman.iwd', sys.argv[1]), 16 'org.freedesktop.DBus.Properties') 17 18 device.Set('net.connman.iwd.Device', 'Mode', sys.argv[2])