From 06c2d227c85ab2b80e38d999b3dce4b96e6f0060 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Tue, 17 Jul 2018 14:16:07 -0700 Subject: [PATCH] test: adhoc test script --- test/start-adhoc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 test/start-adhoc diff --git a/test/start-adhoc b/test/start-adhoc new file mode 100755 index 00000000..c89f928e --- /dev/null +++ b/test/start-adhoc @@ -0,0 +1,26 @@ +#!/usr/bin/python3 + +import dbus +import sys + +if len(sys.argv) == 4: + open = False +elif len(sys.argv) == 3: + open = True +else: + print("Usage: %s []" % (sys.argv[0])) + sys.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', 'ad-hoc') + +adhoc_iface = dbus.Interface(bus.get_object("net.connman.iwd", sys.argv[1]), + 'net.connman.iwd.AdHoc') + +if open: + adhoc_iface.StartOpen(sys.argv[2]) +else: + adhoc_iface.Start(sys.argv[2], sys.argv[3])