[PATCH] bgscan_learn: Update the initial value of time interval for scan

Gery Kahn geryk at ti.com
Sun Mar 6 05:18:44 EST 2011


Set initial value of time interval for scan according to current
bss signal level.
The current value set to short time interval. In case current bss signal
level is higher than configured threshold, than there is no event to notify
signal change and the scanning will happened too often.


Signed-off-by: Gery Kahn <geryk at ti.com>
---
 wpa_supplicant/bgscan_learn.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/wpa_supplicant/bgscan_learn.c b/wpa_supplicant/bgscan_learn.c
index ee79511..0b3d93d 100644
--- a/wpa_supplicant/bgscan_learn.c
+++ b/wpa_supplicant/bgscan_learn.c
@@ -24,6 +24,7 @@
 #include "driver_i.h"
 #include "scan.h"
 #include "bgscan.h"
+#include "bss.h"
 
 struct bgscan_learn_bss {
 	struct dl_list list;
@@ -390,6 +391,7 @@ static void * bgscan_learn_init(struct wpa_supplicant *wpa_s,
 				const struct wpa_ssid *ssid)
 {
 	struct bgscan_learn_data *data;
+	struct wpa_bss *current_bss = wpa_s->current_bss;
 
 	data = os_zalloc(sizeof(*data));
 	if (data == NULL)
@@ -425,7 +427,11 @@ static void * bgscan_learn_init(struct wpa_supplicant *wpa_s,
 	}
 
 	data->supp_freqs = bgscan_learn_get_supp_freqs(wpa_s);
-	data->scan_interval = data->short_interval;
+	if (data->signal_threshold < current_bss->level)
+		data->scan_interval = data->long_interval;
+	else
+		data->scan_interval = data->short_interval;
+
 	eloop_register_timeout(data->scan_interval, 0, bgscan_learn_timeout,
 			       data, NULL);
 
-- 
1.7.0.4



More information about the HostAP mailing list