#endif /* P2P_MAX_INITIAL_CONN_WAIT */
#ifndef P2P_CONCURRENT_SEARCH_DELAY
-#ifdef ANDROID_P2P
-#define P2P_CONCURRENT_SEARCH_DELAY 0
-#else
#define P2P_CONCURRENT_SEARCH_DELAY 500
-#endif
#endif /* P2P_CONCURRENT_SEARCH_DELAY */
enum p2p_group_removal_reason {
#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);
- wpa_s->p2p_cb_on_scan_complete = 1;
+ wpa_s->global->p2p_cb_on_scan_complete = 1;
wpa_supplicant_req_scan(ifs, 0, 0);
return 1;
}
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;
const char *reason;
ssid = wpa_s->current_ssid;
-#ifdef ANDROID_P2P
- if ((ssid == NULL) && (wpa_s->p2p_group_interface == NOT_P2P_GROUP_INTERFACE)) {
-#else
if (ssid == NULL) {
-#endif
/*
* The current SSID was not known, but there may still be a
* pending P2P group interface waiting for provisioning.
break;
ssid = ssid->next;
}
- if (ssid == NULL) {
+ if (ssid == NULL &&
+ wpa_s->p2p_group_interface == NOT_P2P_GROUP_INTERFACE)
+ {
wpa_printf(MSG_ERROR, "P2P: P2P group interface "
"not found");
return -1;
#ifdef ANDROID_P2P
/* For client Second phase of Group formation (4-way handshake) can be still pending
* So we need to restore wpa_s->global->p2p_group_formation */
+ wpa_printf(MSG_INFO, "Restoring back wpa_s->global->p2p_group_formation to wpa_s %p\n", wpa_s);
wpa_s->global->p2p_group_formation = wpa_s;
#endif
#ifndef CONFIG_NO_STDOUT_DEBUG
struct wpa_supplicant *wpa_s = ctx;
char devtype[WPS_DEV_TYPE_BUFSIZE];
-
+#define WFD_DEV_INFO_SIZE 9
+ char wfd_dev_info_hex[2 * WFD_DEV_INFO_SIZE + 1];
+ os_memset(wfd_dev_info_hex, 0, sizeof(wfd_dev_info_hex));
+#ifdef CONFIG_WIFI_DISPLAY
+ if (info->wfd_subelems) {
+ wpa_snprintf_hex(wfd_dev_info_hex, sizeof(wfd_dev_info_hex),
+ wpabuf_head(info->wfd_subelems),
+ 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 "
- "dev_capab=0x%x group_capab=0x%x",
+ "dev_capab=0x%x group_capab=0x%x%s%s",
MAC2STR(addr), MAC2STR(info->p2p_device_addr),
wps_dev_type_bin2str(info->pri_dev_type, devtype,
sizeof(devtype)),
info->device_name, info->config_methods,
- info->dev_capab, info->group_capab);
+ info->dev_capab, info->group_capab,
+ wfd_dev_info_hex[0] ? " wfd_dev_info=0x" : "", wfd_dev_info_hex);
#endif /* CONFIG_NO_STDOUT_DEBUG */
wpas_notify_p2p_device_found(ctx, info->p2p_device_addr, new_device);
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");
int wpas_p2p_in_progress(struct wpa_supplicant *wpa_s)
{
-#ifdef ANDROID_P2P
- struct wpa_supplicant *group = wpa_s;
-#endif
-
if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
return 0;
-#ifdef ANDROID_P2P
- while (group && (group->p2p_group_interface != NOT_P2P_GROUP_INTERFACE)) {
- if(group->wpa_state == WPA_ASSOCIATED) {
- /* WPA_ASSOCIATED hasn't moved to WPA_COMPLETED. So it could be in WPS
- * or 4Way Hanshake phase. Avoid allowing scan during this time critical
- * phase
- */
- wpa_printf(MSG_ERROR, "P2P: WPS/4way handshake in Progress."
- " Defer SCAN ");
- return 1;
- }
- group = group->next;
- }
-#endif
-
return p2p_in_progress(wpa_s->global->p2p);
}
* P2P Client, remove the interface depending up on the connection
* priority */
if(!wpas_is_p2p_prioritized(wpa_s)) {
- /* STA connection has priority over existing
+ /* STA connection has priority over existing
* P2P connection. So remove the interface */
wpa_printf(MSG_DEBUG, "P2P: Removing P2P connection due to Single channel"
"concurrent mode frequency conflict");