[PATCH] Android: Add NO_EVENT parameter to status command

vandwalle vandwalle
Thu Sep 11 11:40:14 PDT 2014


It also allows to use the STATUS command with default behavior,
say for debug, i.e. don't generate a "fake" CONNECTION and
SUPPLICANT_STATE_CHANGE events

Change-Id: I2f3bd178dbbf930728eeef6b2b5e13e000149f11
Signed-off-by: Dmitry Shmidt <dimitrysh at google.com>
---
 wpa_supplicant/ctrl_iface.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index f612b49..7cf292e 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -1768,7 +1768,10 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s,
 #endif /* CONFIG_WPS */
 
 #ifdef ANDROID
-	wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_STATE_CHANGE
+	if (os_strcmp(params, "-NO_EVENTS")) {
+	// Allow using the STATUS command with default behavior, say for debug,
+	// i.e. don't generate a "fake" CONNECTION and SUPPLICANT_STATE_CHANGE events
+	    wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_STATE_CHANGE
 		     "id=%d state=%d BSSID=" MACSTR " SSID=%s",
 		     wpa_s->current_ssid ? wpa_s->current_ssid->id : -1,
 		     wpa_s->wpa_state,
@@ -1776,14 +1779,15 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s,
 		     wpa_s->current_ssid && wpa_s->current_ssid->ssid ?
 		     wpa_ssid_txt(wpa_s->current_ssid->ssid,
 				  wpa_s->current_ssid->ssid_len) : "");
-	if (wpa_s->wpa_state == WPA_COMPLETED) {
-		struct wpa_ssid *ssid = wpa_s->current_ssid;
-		wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_CONNECTED
+	    if (wpa_s->wpa_state == WPA_COMPLETED) {
+		    struct wpa_ssid *ssid = wpa_s->current_ssid;
+		    wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_CONNECTED
 			     "- connection to " MACSTR
 			     " completed %s [id=%d id_str=%s]",
 			     MAC2STR(wpa_s->bssid), "(auth)",
 			     ssid ? ssid->id : -1,
 			     ssid && ssid->id_str ? ssid->id_str : "");
+	    }
 	}
 #endif /* ANDROID */
 
-- 
2.1.0.rc2.206.gedb03e5




More information about the Hostap mailing list