3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-23 22:42:37 +01:00

test: adhoc test script

This commit is contained in:
James Prestwood 2018-07-17 14:16:07 -07:00 committed by Denis Kenzior
parent bea6a9f522
commit 06c2d227c8

26
test/start-adhoc Executable file
View File

@ -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 <device> <ssid> [<passphrase>]" % (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])