os/board/rtl8721csm : Support Single channel scan
Modified the scan implementation to support,  Full scan/Scan with SSID/Scan with channel/Scan with SSID in specific channel
@@ -485,7 +485,22 @@ trwifi_result_e wifi_netmgr_utils_scan_ap(struct netdev *dev, trwifi_scan_config
g_scan_num = 0;
g_scan_list = NULL;
if (config) {
- if (config->ssid_length > 0) {
+ if ((config->channel >= 1) && (config->channel <= 13)) {
+ uint32_t channel;
+ uint8_t pscan_config;
+ if (config->ssid_length == 0) {
+ rtw_memset(config->ssid, 0, sizeof(config->ssid));
+ config->ssid_length = 0;
+ }
+ channel = config->channel;
+ channel &= 0xff;
+ pscan_config = PSCAN_ENABLE;
+ if (wifi_set_pscan_chan((uint8_t *)&channel, &pscan_config, 1) < 0 ) {
+ RTW_API_INFO("set pscan channel failed\n");
+ return TRWIFI_FAIL;
+ }
+ }
+ if ((config->ssid_length > 0) || ((config->channel >= 1) && (config->channel <= 13))) {
int scan_buf_len = 500;
rltk_wlan_enable_scan_with_ssid_by_extended_security(1);
if (wifi_scan_networks_with_ssid(parse_scan_with_ssid_res, NULL,
@@ -493,8 +508,8 @@ trwifi_result_e wifi_netmgr_utils_scan_ap(struct netdev *dev, trwifi_scan_config
return TRWIFI_FAIL;
}
} else {
- // scan specified channel.
- return TRWIFI_NOT_SUPPORTED;
+ RTW_API_INFO("Invalid channel range\n");
+ return TRWIFI_FAIL;
}
} else {
if (wifi_scan_networks(app_scan_result_handler, NULL ) != RTW_SUCCESS) {
