From 4aa8186806dbc6774305ab94d63ef7f202f430d1 Mon Sep 17 00:00:00 2001 From: Sheng Fang Date: Tue, 7 May 2013 12:41:14 +0300 Subject: [PATCH] Add a configration parameter for sched_scan interval The new sched_scan_interval parameter can be used to set the default sched_scan interval, e.g., for power saving purposes. Signed-hostap: Jouni Malinen --- wpa_supplicant/config.c | 1 + wpa_supplicant/config.h | 5 +++++ wpa_supplicant/config_file.c | 4 ++++ wpa_supplicant/scan.c | 4 +++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index aceaa02b1..b25e0f673 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -3105,6 +3105,7 @@ static const struct global_parse_data global_fields[] = { { FUNC(ap_vendor_elements), 0 }, { INT_RANGE(ignore_old_scan_res, 0, 1), 0 }, { FUNC(freq_list), 0 }, + { INT(sched_scan_interval), 0 }, }; #undef FUNC diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h index cdaaa8948..a1a523992 100644 --- a/wpa_supplicant/config.h +++ b/wpa_supplicant/config.h @@ -862,6 +862,11 @@ struct wpa_config { * allowing it to update the internal BSS table. */ int ignore_old_scan_res; + + /** + * sched_scan_interval - schedule scan interval + */ + unsigned int sched_scan_interval; }; diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index ed6b3f2b5..8ff42852d 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -1025,6 +1025,10 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config) } fprintf(f, "\n"); } + + if (config->sched_scan_interval) + fprintf(f, "sched_scan_interval=%u\n", + config->sched_scan_interval); } #endif /* CONFIG_NO_CONFIG_WRITE */ diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 8d4c7f1a7..239969244 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -1019,7 +1019,9 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s) if (!ssid || !wpa_s->prev_sched_ssid) { wpa_dbg(wpa_s, MSG_DEBUG, "Beginning of SSID list"); - + if (wpa_s->conf->sched_scan_interval) + wpa_s->sched_scan_interval = + wpa_s->conf->sched_scan_interval; if (wpa_s->sched_scan_interval == 0) wpa_s->sched_scan_interval = 10; wpa_s->sched_scan_timeout = max_sched_scan_ssids * 2;