Android: Add NO_EVENTS parameter to status command
authorvandwalle <vandwalle@google.com>
Thu, 11 Sep 2014 18:40:14 +0000 (11:40 -0700)
committerJouni Malinen <j@w1.fi>
Sat, 13 Sep 2014 14:03:16 +0000 (17:03 +0300)
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 with the new STATUS-NO_EVENTS case.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
wpa_supplicant/ctrl_iface.c

index 8ddb86e..2304944 100644 (file)
@@ -1768,22 +1768,29 @@ 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
-                    "id=%d state=%d BSSID=" MACSTR " SSID=%s",
-                    wpa_s->current_ssid ? wpa_s->current_ssid->id : -1,
-                    wpa_s->wpa_state,
-                    MAC2STR(wpa_s->bssid),
-                    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
-                            "- 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 : "");
+       /*
+        * Allow using the STATUS command with default behavior, say for debug,
+        * i.e., don't generate a "fake" CONNECTION and SUPPLICANT_STATE_CHANGE
+        * events with STATUS-NO_EVENTS.
+        */
+       if (os_strcmp(params, "-NO_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,
+                            MAC2STR(wpa_s->bssid),
+                            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
+                                    "- 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 */