[PATCH 2/2] pno: change sched_scan_stopped event to handle pending pno properly

Ilan Peer ilan.peer at intel.com
Wed Feb 26 01:04:11 EST 2014


From: Alexander Bondar <alexander.bondar at intel.com>

When a sched_scan_stopped event is received and there is a pending PNO,
it uses regular scheduled scan parameters instead of PNO specific
parameters. Change it by calling wpas_start_pno.

Signed-off-by: Alexander Bondar <alexander.bondar at intel.com>
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 wpa_supplicant/events.c |   14 +++++---------
 wpa_supplicant/scan.c   |   17 ++++++++++-------
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 47434e4..37c3733 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -3302,15 +3302,11 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 		 * Start a new sched scan to continue searching for more SSIDs
 		 * either if timed out or PNO schedule scan is pending.
 		 */
-		if (wpa_s->sched_scan_timed_out || wpa_s->pno_sched_pending) {
-
-			if (wpa_supplicant_req_sched_scan(wpa_s) < 0 &&
-			    wpa_s->pno_sched_pending) {
-				wpa_msg(wpa_s, MSG_ERROR, "Failed to schedule PNO");
-			} else if (wpa_s->pno_sched_pending) {
-				wpa_s->pno_sched_pending = 0;
-				wpa_s->pno = 1;
-			}
+		if (wpa_s->sched_scan_timed_out) {
+			wpa_supplicant_req_sched_scan(wpa_s);
+		} else if (wpa_s->pno_sched_pending) {
+			wpa_s->pno_sched_pending = 0;
+			wpas_start_pno(wpa_s);
 		}
 
 		break;
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index b92a064..77b3e44 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -1816,6 +1816,9 @@ int wpas_start_pno(struct wpa_supplicant *wpa_s)
 	struct wpa_ssid *ssid;
 	struct wpa_driver_scan_params params;
 
+	if (!wpa_s->sched_scan_supported)
+		return -1;
+
 	if (wpa_s->pno || wpa_s->pno_sched_pending)
 		return 0;
 
@@ -1888,6 +1891,8 @@ int wpas_start_pno(struct wpa_supplicant *wpa_s)
 	os_free(params.filter_ssids);
 	if (ret == 0)
 		wpa_s->pno = 1;
+	else
+		wpa_msg(wpa_s, MSG_ERROR, "Failed to schedule PNO");
 	return ret;
 }
 
@@ -1896,11 +1901,12 @@ int wpas_stop_pno(struct wpa_supplicant *wpa_s)
 {
 	int ret = 0;
 
-	if (wpa_s->pno || wpa_s->sched_scanning) {
-		wpa_s->pno = 0;
-		ret = wpa_supplicant_stop_sched_scan(wpa_s);
-	}
+	if (!wpa_s->pno)
+		return 0;
+
+	ret = wpa_supplicant_stop_sched_scan(wpa_s);
 
+	wpa_s->pno = 0;
 	wpa_s->pno_sched_pending = 0;
 
 	if (wpa_s->wpa_state == WPA_SCANNING)
@@ -1908,6 +1914,3 @@ int wpas_stop_pno(struct wpa_supplicant *wpa_s)
 
 	return ret;
 }
-
-
-
-- 
1.7.10.4



More information about the HostAP mailing list