force-roam (1045B)
1 #!/usr/bin/python3 2 3 import sys 4 import dbus 5 6 if len(sys.argv) < 2 or len(sys.argv) > 3: 7 print("Usage: %s [device] <mac>" % (sys.argv[0])) 8 sys.exit(1) 9 10 bus = dbus.SystemBus() 11 device = None 12 13 if len(sys.argv) == 2: 14 manager = dbus.Interface(bus.get_object("net.connman.iwd", "/"), 15 "org.freedesktop.DBus.ObjectManager") 16 objects = manager.GetManagedObjects() 17 for path in objects: 18 for interface in objects[path]: 19 if interface == "net.connman.iwd.StationDebug": 20 device = dbus.Interface(bus.get_object("net.connman.iwd", path), 21 "net.connman.iwd.StationDebug") 22 break 23 24 if not device: 25 print("StationDebug interface not found") 26 exit() 27 28 mac = sys.argv[1] 29 else: 30 device = dbus.Interface(bus.get_object("net.connman.iwd", sys.argv[1]), 31 "net.connman.iwd.StationDebug") 32 mac = sys.argv[2] 33 34 mac = mac.replace(':', '') 35 device.Roam(dbus.ByteArray.fromhex(mac))