iwd/test/list-devices

37 lines
972 B
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", "/"),
"net.connman.iwd.Manager")
devices = manager.GetDevices()
for path in devices:
print("[ %s ]" % path)
properties = devices[path]
for key in properties.keys():
val = properties[key]
print(" %s = %s" % (key, val))
print(" Networks:")
device = dbus.Interface(bus.get_object("net.connman.iwd", path),
"net.connman.iwd.Device")
networks = device.GetNetworks()
for path in networks:
print(" [ %s ]" % path)
properties = networks[path]
for key in properties.keys():
if key in ["SSID"]:
val = properties[key]
val = "".join(map(chr, val))
else:
val = properties[key]
print(" %s = %s" % (key, val))