Remove set_powered() calls based on IFF_UP
authorKalle Valo <kalle.valo@canonical.com>
Wed, 5 May 2010 14:02:50 +0000 (17:02 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 6 May 2010 05:41:34 +0000 (07:41 +0200)
wpa_supplicant 0.7.2+ (from git) didn't connect automatically to a wifi
network. I found out that this because of two calls to
connman_device_set_powered(), from wifi_newlink() and get_interface_reply().
The former was called first and causing the latter call not to trigger a
scan.

Because wpa_supplicant is initialised only in get_interface_reply(), and I
wasn't able to find a reason for the set_powered() call in wifi_newlink(),
the call in wifi_newlink() can be removed. Now connman will work with
both 0.6 and 0.7 versions of wpa_supplicant.

Also the supplicant_scan() is not needed, calling connman_device_set_powered()
in get_interface_reply() will trigger a scan.

plugins/wifi.c

index dbe4abb..34c1634 100644 (file)
@@ -99,12 +99,9 @@ static void wifi_newlink(unsigned flags, unsigned change, void *user_data)
 
        if ((wifi->flags & IFF_UP) != (flags & IFF_UP)) {
                if (flags & IFF_UP) {
-                       DBG("power on");
-                       connman_device_set_powered(device, TRUE);
-                       supplicant_scan(device);
+                       DBG("interface up");
                } else {
-                       connman_device_set_powered(device, FALSE);
-                       DBG("power off");
+                       DBG("interface down");
                }
        }