aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/examples
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-01-01 11:16:33 (GMT)
committerJouni Malinen <j@w1.fi>2010-01-01 11:16:33 (GMT)
commite7f7d231a466a971115db124a3fa33cc0fa890f6 (patch)
tree0de277529dab549fd7b0caa45fb8c29aea0fd071 /wpa_supplicant/examples
parent70993cd8e2d6f650a028ed492d61f92fba5f5a9b (diff)
downloadhostap-e7f7d231a466a971115db124a3fa33cc0fa890f6.zip
hostap-e7f7d231a466a971115db124a3fa33cc0fa890f6.tar.gz
hostap-e7f7d231a466a971115db124a3fa33cc0fa890f6.tar.bz2
dbus: Fix example get-list-of-interfaces operation
Diffstat (limited to 'wpa_supplicant/examples')
-rwxr-xr-xwpa_supplicant/examples/wpas-dbus-new.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/wpa_supplicant/examples/wpas-dbus-new.py b/wpa_supplicant/examples/wpas-dbus-new.py
index 934243b..156b4fb 100755
--- a/wpa_supplicant/examples/wpas-dbus-new.py
+++ b/wpa_supplicant/examples/wpas-dbus-new.py
@@ -25,9 +25,13 @@ def byte_array_to_string(s):
return r
def list_interfaces(wpas_obj):
- ifaces = wpas_obj.Interfaces
- for i in ifaces:
- print "%s" (i)
+ ifaces = wpas_obj.Get(WPAS_DBUS_INTERFACE, 'Interfaces',
+ dbus_interface=dbus.PROPERTIES_IFACE)
+ for path in ifaces:
+ if_obj = bus.get_object(WPAS_DBUS_SERVICE, path)
+ ifname = if_obj.Get(WPAS_DBUS_INTERFACES_INTERFACE, 'Ifname',
+ dbus_interface=dbus.PROPERTIES_IFACE)
+ print ifname
def stateChanged(newState, oldState):
print "StateChanged(%s -> %s)" % (oldState, newState)
@@ -91,6 +95,11 @@ def main():
global bus
bus = dbus.SystemBus()
wpas_obj = bus.get_object(WPAS_DBUS_SERVICE, WPAS_DBUS_OPATH)
+
+ if len(sys.argv) != 2:
+ list_interfaces(wpas_obj)
+ os._exit(1)
+
wpas = dbus.Interface(wpas_obj, WPAS_DBUS_INTERFACE)
bus.add_signal_receiver(scanDone,
dbus_interface=WPAS_DBUS_INTERFACES_INTERFACE,
@@ -105,10 +114,6 @@ def main():
dbus_interface=WPAS_DBUS_INTERFACES_INTERFACE,
signal_name="StateChanged")
- if len(sys.argv) != 2:
- list_interfaces(wpas_obj)
- os._exit(1)
-
ifname = sys.argv[1]
# See if wpa_supplicant already knows about this interface