return "INVITE";
case P2P_INVITE_LISTEN:
return "INVITE_LISTEN";
+ case P2P_SEARCH_WHEN_READY:
+ return "SEARCH_WHEN_READY";
default:
return "?";
}
p2p_device_clear_reported(p2p);
p2p_set_state(p2p, P2P_SEARCH);
eloop_cancel_timeout(p2p_find_timeout, p2p, NULL);
+ p2p->last_p2p_find_timeout = timeout;
if (timeout)
eloop_register_timeout(timeout, 0, p2p_find_timeout,
p2p, NULL);
eloop_cancel_timeout(p2p_scan_timeout, p2p, NULL);
eloop_register_timeout(P2P_SCAN_TIMEOUT, 0, p2p_scan_timeout,
p2p, NULL);
+ } else if (res == 1) {
+ wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Could not start "
+ "p2p_scan at this point - will try again after "
+ "previous scan completes");
+ res = 0;
+ p2p_set_state(p2p, P2P_SEARCH_WHEN_READY);
+ eloop_cancel_timeout(p2p_find_timeout, p2p, NULL);
} else {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Failed to start "
"p2p_scan");
}
+int p2p_other_scan_completed(struct p2p_data *p2p)
+{
+ if (p2p->state != P2P_SEARCH_WHEN_READY)
+ return 0;
+ wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Starting pending P2P find "
+ "now that previous scan was completed");
+ if (p2p_find(p2p, p2p->last_p2p_find_timeout, p2p->find_type,
+ p2p->num_req_dev_types, p2p->req_dev_types) < 0)
+ return 0;
+ return 1;
+}
+
+
void p2p_stop_find_for_freq(struct p2p_data *p2p, int freq)
{
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Stopping find");
case P2P_INVITE_LISTEN:
p2p_timeout_invite_listen(p2p);
break;
+ case P2P_SEARCH_WHEN_READY:
+ break;
}
}
*/
int p2p_in_progress(struct p2p_data *p2p);
+/**
+ * p2p_other_scan_completed - Notify completion of non-P2P scan
+ * @p2p: P2P module context from p2p_init()
+ * Returns: 0 if P2P module is idle or 1 if an operation was started
+ */
+int p2p_other_scan_completed(struct p2p_data *p2p);
+
#endif /* P2P_H */
* P2P_INVITE_LISTEN - Listen during Invite
*/
P2P_INVITE_LISTEN,
+
+ /**
+ * P2P_SEARCH_WHEN_READY - Waiting to start Search
+ */
+ P2P_SEARCH_WHEN_READY,
} state;
/**
int inv_persistent;
enum p2p_discovery_type find_type;
+ unsigned int last_p2p_find_timeout;
u8 last_prog_scan_class;
u8 last_prog_scan_chan;
int p2p_scan_running;
wpa_supplicant_notify_scanning(wpa_s, 0);
+#ifdef CONFIG_P2P
+ if (wpa_s->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled &&
+ wpa_s->global->p2p != NULL) {
+ wpa_s->p2p_cb_on_scan_complete = 0;
+ if (p2p_other_scan_completed(wpa_s->global->p2p) == 1) {
+ wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Pending P2P operation "
+ "stopped scan processing");
+ return -1;
+ }
+ }
+#endif /* CONFIG_P2P */
+
scan_res = wpa_supplicant_get_scan_results(wpa_s,
data ? &data->scan_info :
NULL, 1);
struct wpabuf *wps_ie, *ies;
int social_channels[] = { 2412, 2437, 2462, 0, 0 };
size_t ielen;
+ int was_in_p2p_scan;
if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
return -1;
break;
}
+ was_in_p2p_scan = wpa_s->scan_res_handler == wpas_p2p_scan_res_handler;
wpa_s->scan_res_handler = wpas_p2p_scan_res_handler;
ret = wpa_drv_scan(wpa_s, ¶ms);
wpabuf_free(ies);
- if (ret < 0)
+ if (ret) {
wpa_s->scan_res_handler = NULL;
+ if (wpa_s->scanning || was_in_p2p_scan) {
+ wpa_s->p2p_cb_on_scan_complete = 1;
+ ret = 1;
+ }
+ }
return ret;
}
wpa_s->p2p_long_listen = 0;
eloop_cancel_timeout(wpas_p2p_long_listen_timeout, wpa_s, NULL);
eloop_cancel_timeout(wpas_p2p_join_scan, wpa_s, NULL);
+ wpa_s->p2p_cb_on_scan_complete = 0;
if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT) {
wpa_drv_p2p_stop_find(wpa_s);
P2P_GROUP_REMOVAL_IDLE_TIMEOUT,
P2P_GROUP_REMOVAL_UNAVAILABLE
} removal_reason;
+
+ unsigned int p2p_cb_on_scan_complete:1;
#endif /* CONFIG_P2P */
struct wpa_ssid *bgscan_ssid;