From: Jouni Malinen Date: Fri, 9 Mar 2012 05:28:13 +0000 (-0800) Subject: Android: Implement SETBAND for scan requests X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=acb97b360033dba1cb26b17aeb8d204fca254b05;p=thirdparty%2Fhostap.git Android: Implement SETBAND for scan requests This provides partial SETBAND driver command implementation by converting the request into a filter for which channels are scanned by wpa_supplicant. --- diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 73ef0b9f2..7963bc8a7 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -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) {