From c6a35d9005cd5ded0e369780726a48ccd56e7623 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Thu, 19 Jul 2018 09:22:27 -0700 Subject: [PATCH] test: utility to set device mode There was no way to stop ap/adhoc once started. --- test/set-mode | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 test/set-mode diff --git a/test/set-mode b/test/set-mode new file mode 100755 index 00000000..0f03b7d9 --- /dev/null +++ b/test/set-mode @@ -0,0 +1,18 @@ +#!/usr/bin/python3 + +import dbus +import sys + +if len(sys.argv) != 3: + print('Usage: %s ' % sys.argv[0]) + exit(1) + +if sys.argv[2] not in ['station', 'ap', 'ad-hoc']: + print(' must be station, ap or ad-hoc') + exit(1) + +bus = dbus.SystemBus() +device = dbus.Interface(bus.get_object('net.connman.iwd', sys.argv[1]), + 'org.freedesktop.DBus.Properties') + +device.Set('net.connman.iwd.Device', 'Mode', sys.argv[2])