]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Android: Implement SETBAND for scan requests
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 9 Mar 2012 05:28:13 +0000 (21:28 -0800)
committerJouni Malinen <j@w1.fi>
Sun, 24 Nov 2013 20:46:39 +0000 (22:46 +0200)
This provides partial SETBAND driver command implementation by
converting the request into a filter for which channels are scanned
by wpa_supplicant.

wpa_supplicant/ctrl_iface.c

index 73ef0b9f2fc7df2d86f8ca4f9ce951c3b9645fce..7963bc8a740699f8b15b3f7fdbf482118bb22b9c 100644 (file)
@@ -5168,7 +5168,26 @@ static int wpa_supplicant_driver_cmd(struct wpa_supplicant *wpa_s, char *cmd,
                ret = pno_start(wpa_s);
        else if (os_strcasecmp(cmd, "BGSCAN-STOP") == 0)
                ret = pno_stop(wpa_s);
-       else
+       else if (os_strncasecmp(cmd, "SETBAND ", 8) == 0) {
+               int val = atoi(cmd + 8);
+               /*
+                * Use driver_cmd for drivers that support it, but ignore the
+                * return value since scan requests from wpa_supplicant will
+                * provide a list of channels to scan for based on the SETBAND
+                * setting.
+                */
+               wpa_printf(MSG_DEBUG, "SETBAND: %d", val);
+               wpa_drv_driver_cmd(wpa_s, cmd, buf, buflen);
+               ret = 0;
+               if (val == 0)
+                       wpa_s->setband = WPA_SETBAND_AUTO;
+               else if (val == 1)
+                       wpa_s->setband = WPA_SETBAND_5G;
+               else if (val == 2)
+                       wpa_s->setband = WPA_SETBAND_2G;
+               else
+                       ret = -1;
+       } else
                ret = wpa_drv_driver_cmd(wpa_s, cmd, buf, buflen);
        if (ret == 0) {
                if (os_strncasecmp(cmd, "COUNTRY", 7) == 0) {