sta_scan: WaitCompletion,1
Allow sta_scan to be requested to wait for the scan to complete before
reporting CAPI command completion.
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
diff --git a/sta.c b/sta.c
index f256785..341a27a 100644
--- a/sta.c
+++ b/sta.c
@@ -12910,6 +12910,7 @@
int wildcard_ssid = 0;
int res;
enum sigma_cmd_result status;
+ struct wpa_ctrl *ctrl = NULL;
start_sta_mode(dut);
@@ -12985,6 +12986,16 @@
scan_freq = get_param(cmd, "ChnlFreq");
+ val = get_param(cmd, "WaitCompletion");
+ if (val && atoi(val) == 1) {
+ ctrl = open_wpa_mon(intf);
+ if (!ctrl) {
+ send_resp(dut, conn, SIGMA_ERROR,
+ "errorCode,Failed to open monitor socket");
+ return STATUS_SENT_ERROR;
+ }
+ }
+
res = snprintf(buf, sizeof(buf), "SCAN%s%s%s%s%s%s%s",
bssid ? " bssid=": "",
bssid ? bssid : "",
@@ -13013,6 +13024,22 @@
sigma_dut_print(dut, DUT_MSG_ERROR,
"Failed to delete vendor element");
+ if (ctrl) {
+ if (status == SUCCESS_SEND_STATUS) {
+ res = get_wpa_cli_event(dut, ctrl,
+ "CTRL-EVENT-SCAN-RESULTS",
+ buf, sizeof(buf));
+ if (res < 0) {
+ send_resp(dut, conn, SIGMA_ERROR,
+ "ErrorCode,scan did not complete");
+ status = STATUS_SENT_ERROR;
+ }
+ }
+
+ wpa_ctrl_detach(ctrl);
+ wpa_ctrl_close(ctrl);
+ }
+
return status;
}