* How many seconds to try to reconnect to the GO when connection in P2P client
* role has been lost.
*/
+#ifdef ANDROID_P2P
+#define P2P_MAX_CLIENT_IDLE 20
+#else
#define P2P_MAX_CLIENT_IDLE 10
+#endif /* ANDROID_P2P */
#endif /* P2P_MAX_CLIENT_IDLE */
-
+#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_group_idle_timeout(void *eloop_ctx, void *timeout_ctx);
static void wpas_p2p_set_group_idle_timeout(struct wpa_supplicant *wpa_s);
+#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)
if (ret) {
wpa_s->scan_res_handler = NULL;
+#ifdef ANDROID_P2P
+ if (wpa_s->scanning || was_in_p2p_scan || wpas_global_scan_in_progress(wpa_s)) {
+#else
if (wpa_s->scanning || was_in_p2p_scan) {
+#endif
wpa_s->p2p_cb_on_scan_complete = 1;
ret = 1;
}
if (!wpa_s->ap_iface)
return;
wpa_printf(MSG_DEBUG, "P2P: GO - group %sidle", idle ? "" : "not ");
- if (idle)
+ if (idle) {
+ wpa_printf(MSG_DEBUG,"Calling set group idle time out from idle_update");
wpas_p2p_set_group_idle_timeout(wpa_s);
+ }
else
eloop_cancel_timeout(wpas_p2p_group_idle_timeout, wpa_s, NULL);
}
return;
}
- wpa_printf(MSG_DEBUG, "P2P: Group idle timeout reached - terminate "
- "group");
+ wpa_printf(MSG_DEBUG, "P2P: Group idle timeout reached - terminate %d"
+ "group",wpa_s->conf->p2p_group_idle);
wpa_s->removal_reason = P2P_GROUP_REMOVAL_IDLE_TIMEOUT;
wpas_p2p_group_delete(wpa_s);
}
if (!wpa_s->ap_iface &&
!eloop_is_timeout_registered(wpas_p2p_group_idle_timeout,
wpa_s, NULL))
+ {
+ wpa_printf(MSG_DEBUG,"Calling set grouple idle_timeout from notif_disconnected");
wpas_p2p_set_group_idle_timeout(wpa_s);
+ }
}
wpa_s->parent, NULL) > 0) {
wpa_printf(MSG_DEBUG, "P2P: Canceled group formation due to "
"P2P group network getting removed");
+#ifdef ANDROID_P2P
+ /* Give time for any Pending WPS Frame exchange */
+ eloop_register_timeout(5, 0, wpas_p2p_group_formation_timeout,
+ wpa_s->parent, NULL);
+#else
wpas_p2p_group_formation_timeout(wpa_s->parent, NULL);
+#endif
}
}