3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-30 06:39:46 +01:00
iwd/test/list-devices

43 lines
1.0 KiB
Plaintext
Raw Normal View History

2016-04-28 01:27:25 +02:00
#!/usr/bin/python3
2015-03-26 06:11:18 +01:00
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']
2015-03-26 06:11:18 +01:00
print("[ %s ]" % path)
for key in device.keys():
val = device[key]
2015-03-26 06:11:18 +01:00
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)
2015-03-26 06:11:18 +01:00
for key in network.keys():
2015-03-26 06:11:18 +01:00
if key in ["SSID"]:
val = network[key]
2015-03-26 06:11:18 +01:00
val = "".join(map(chr, val))
else:
val = network[key]
2015-03-26 06:11:18 +01:00
print(" %s = %s" % (key, val))