mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-18 09:12:43 +01:00
test: Add list-devices script
This commit is contained in:
parent
86ea449cd1
commit
38757e2fed
36
test/list-devices
Executable file
36
test/list-devices
Executable file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
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))
|
Loading…
Reference in New Issue
Block a user