From 279ed50441b01669315f4e49b8eb629a6d5a9e8a Mon Sep 17 00:00:00 2001 From: Tomasz Bursztyka Date: Wed, 11 Mar 2015 15:31:51 +0200 Subject: [PATCH] wiphy: Don't parse attributes of scan reply The success or not of a scan command is found from the message directly. There's no need to look for any attribute from the scan netlink answer. The message is an error message or not, and that tells if the scan has been started or not. --- src/wiphy.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/wiphy.c b/src/wiphy.c index 751b3c2b..a869dde1 100644 --- a/src/wiphy.c +++ b/src/wiphy.c @@ -478,20 +478,16 @@ static struct l_dbus_message *device_get_properties(struct l_dbus *dbus, static void device_scan_callback(struct l_genl_msg *msg, void *user_data) { struct netdev *netdev = user_data; - struct l_genl_attr attr; - uint16_t type, len; - const void *data; struct l_dbus_message *reply; - if (!l_genl_attr_init(&attr, msg)) { + l_debug("Scan callback"); + + if (l_genl_msg_get_error(msg) < 0) { dbus_pending_reply(&netdev->scan_pending, dbus_error_failed(netdev->scan_pending)); return; } - while (l_genl_attr_next(&attr, &type, &len, &data)) { - } - l_debug("Scan triggered for netdev %s", netdev->name); reply = l_dbus_message_new_method_return(netdev->scan_pending); @@ -505,6 +501,8 @@ static struct l_dbus_message *device_scan(struct l_dbus *dbus, { struct netdev *netdev = user_data; + l_debug("Scan called from DBus"); + if (netdev->scan_pending) return dbus_error_busy(message);