3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-23 07:29:28 +01:00
iwd/test/list-devices
2016-05-23 11:49:25 -05:00

43 lines
1.0 KiB
Python
Executable File

#!/usr/bin/python3
import sys
import dbus
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object("net.connman.iwd", "/"),
"org.freedesktop.DBus.ObjectManager")
objects = manager.GetManagedObjects()
for path in objects:
if 'net.connman.iwd.Device' not in objects[path]:
continue
device = objects[path]['net.connman.iwd.Device']
print("[ %s ]" % path)
for key in device.keys():
val = device[key]
print(" %s = %s" % (key, val))
print(" Networks:")
for path2 in objects:
if not path2.startswith(path) or \
'net.connman.iwd.Network' not in objects[path2]:
continue
network = objects[path2]['net.connman.iwd.Network']
print(" [ %s ]" % path2)
for key in network.keys():
if key in ["SSID"]:
val = network[key]
val = "".join(map(chr, val))
else:
val = network[key]
print(" %s = %s" % (key, val))