#endif
};
-#ifdef ANDROID_P2P
-static int wpas_global_scan_in_progress(struct wpa_supplicant *wpa_s);
-#endif
+
static void wpas_p2p_long_listen_timeout(void *eloop_ctx, void *timeout_ctx);
static struct wpa_supplicant *
wpas_p2p_get_group_iface(struct wpa_supplicant *wpa_s, int addr_allocated,
static void wpas_p2p_fallback_to_go_neg(struct wpa_supplicant *wpa_s,
int group_added);
-#ifdef ANDROID_P2P
-static int wpas_global_scan_in_progress(struct wpa_supplicant *wpa_s)
-{
- struct wpa_supplicant *iface = NULL;
-
- for (iface = wpa_s->global->ifaces; iface; iface = iface->next) {
- if(iface->scanning || iface->wpa_state == WPA_SCANNING) {
- wpa_printf(MSG_DEBUG, "P2P: Scan in progress on %s,"
- "defer P2P SEARCH", iface->ifname);
- return 1;
- }
- }
-
- return 0;
-}
-#endif
static void wpas_p2p_scan_res_handler(struct wpa_supplicant *wpa_s,
struct wpa_scan_results *scan_res)
wpa_printf(MSG_DEBUG, "Delaying P2P scan to allow "
"pending station mode scan to be "
"completed on interface %s", ifs->ifname);
-#ifdef ANDROID_P2P
- ifs->p2p_cb_on_scan_complete = 1;
-#else
- wpa_s->p2p_cb_on_scan_complete = 1;
-#endif
+ wpa_s->global->p2p_cb_on_scan_complete = 1;
wpa_supplicant_req_scan(ifs, 0, 0);
return 1;
}
-#ifdef ANDROID_P2P
- else if(ifs->scanning) {
- wpa_printf(MSG_DEBUG, "Wait for the STA scan"
- "to be "
- "completed on interface %s", ifs->ifname);
- ifs->p2p_cb_on_scan_complete = 1;
- return 1;
- }
-#endif
}
os_memset(¶ms, 0, sizeof(params));
wpabuf_free(ies);
if (ret) {
- if (wpa_s->scanning ||
- wpa_s->scan_res_handler == wpas_p2p_scan_res_handler) {
- wpa_s->p2p_cb_on_scan_complete = 1;
- ret = 1;
+ for (ifs = wpa_s->global->ifaces; ifs; ifs = ifs->next) {
+ if (ifs->scanning ||
+ ifs->scan_res_handler == wpas_p2p_scan_res_handler) {
+ wpa_s->global->p2p_cb_on_scan_complete = 1;
+ ret = 1;
+ break;
+ }
}
} else
wpa_s->scan_res_handler = wpas_p2p_scan_res_handler;
WFD_DEV_INFO_SIZE);
}
#endif /* CONFIG_WIFI_DISPLAY */
-
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_DEVICE_FOUND MACSTR
" p2p_dev_addr=" MACSTR
" pri_dev_type=%s name='%s' config_methods=0x%x "
return;
}
+#ifdef ANDROID_P2P
+ /* If provision discovery failed it is safe to cancel the timer here and
+ * also do not start the join */
+ if (wpa_s->pending_pd_before_join &&
+ (os_memcmp(peer, wpa_s->pending_join_dev_addr, ETH_ALEN) == 0 ||
+ os_memcmp(peer, wpa_s->pending_join_iface_addr, ETH_ALEN) == 0)) {
+ wpa_s->pending_pd_before_join = 0;
+ wpa_printf(MSG_DEBUG, "P2P: Do not Start pending "
+ "join-existing-group operation");
+ eloop_cancel_timeout(wpas_p2p_pd_before_join_timeout, wpa_s, NULL);
+ }
+#endif /* ANDROID_P2P */
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_FAILURE
" p2p_dev_addr=" MACSTR " status=%d",
MAC2STR(peer), status);
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;
+ wpa_s->global->p2p_cb_on_scan_complete = 0;
if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT) {
wpa_drv_p2p_stop_find(wpa_s);
wpas_notify_p2p_group_started(wpa_s, ssid, network_id, 1);
done:
- if (wpa_s->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled &&
+ if (wpa_s->global->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled &&
wpa_s->global->p2p != NULL) {
- wpa_s->p2p_cb_on_scan_complete = 0;
+ wpa_s->global->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 "
"continued after successful connection");
rn2 = ifs->driver->get_radio_name(ifs->drv_priv);
if (!rn2 || os_strcmp(rn, rn2) != 0)
continue;
-#ifdef ANDROID_P2P
- /* We need not delay the p2p_scan if STA is already connected */
- if (ifs->wpa_state > WPA_SCANNING && ifs->wpa_state < WPA_COMPLETED) {
-#else
if (ifs->wpa_state > WPA_SCANNING) {
-#endif
wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Use %u ms search "
"delay due to concurrent operation on "
"interface %s",