From a9c73cbf768e920f4adc9573577efbcbe39ed721 Mon Sep 17 00:00:00 2001 From: Eyal Shapira Date: Tue, 25 Sep 2012 10:54:09 +0200 Subject: P2P: block find if P2P GO or CLI are active (INTERNAL) The roc on a channel for 100+ ms which is part of the find disturbs the P2P GO/CLI as these scenarios are unsupported in non multi channel driver. Therefore block the find in this case. Signed-off-by: Eyal Shapira --- wpa_supplicant/p2p_supplicant.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 6603091..3c650c3 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -3969,6 +3969,18 @@ static void wpas_p2p_clear_pending_action_tx(struct wpa_supplicant *wpa_s) wpa_s->pending_action_tx = NULL; } +static int wpas_p2p_connected(struct wpa_supplicant *wpa_s) +{ + struct wpa_supplicant *iface; + + for (iface = wpa_s->global->ifaces; iface; iface = iface->next) { + if (iface->p2p_group_interface == P2P_GROUP_INTERFACE_GO || + iface->p2p_group_interface == P2P_GROUP_INTERFACE_CLIENT) + return 1; + } + + return 0; +} int wpas_p2p_find(struct wpa_supplicant *wpa_s, unsigned int timeout, enum p2p_discovery_type type, @@ -3985,6 +3997,14 @@ int wpas_p2p_find(struct wpa_supplicant *wpa_s, unsigned int timeout, wpa_s->p2p_in_provisioning) return -1; + + if (!(wpa_s->drv_flags & + WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT) && + wpas_p2p_connected(wpa_s)) { + wpa_printf(MSG_DEBUG, "P2P: find blocked due to active GO/CLI"); + return -1; + } + wpa_supplicant_cancel_sched_scan(wpa_s); return p2p_find(wpa_s->global->p2p, timeout, type, -- cgit v1.1