From 63a0580695f0337a91d64e5ca4891880f60fa9bf Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Thu, 8 May 2014 11:11:02 +0200 Subject: [PATCH] wifi: send P2P_FIND on each p2p_scan() request wpa_supplicant is horrible in notifying us about p2p-scans. During failed connection attempts or other timeouts, we usually are not notified about scan-stops. Therefore, a following p2p-scan will simply be ignored as we think it's still running. Avoid that problem by always forwarding the P2P_FIND command. wpa_supplicant can deal with redundant requests so we're fine. Note that this requires the caller to issue these calls in intervals or/and after any issues wifi request. Once wpas fixes this issue, we can add this guard again and the redundant requests will be suppressed. Signed-off-by: David Herrmann --- src/wifi/wifid-supplicant.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/wifi/wifid-supplicant.c b/src/wifi/wifid-supplicant.c index 86268d5..bb79e2a 100644 --- a/src/wifi/wifid-supplicant.c +++ b/src/wifi/wifid-supplicant.c @@ -1864,12 +1864,14 @@ int supplicant_p2p_start_scan(struct supplicant *s) * * Note that we could make this synchronous, but there's no real gain. * You still don't get any meaningful errors from wpa_supplicant, so - * there's really no use to it. + * there's really no use to it. Moreover, wpas' state tracking is quite + * unreliable so we can never know whether we're really still scanning. + * Therefore, we send the P2P_FIND on _each_ start_scan() request. It's + * the callers responsibility to send it in proper intervals or after + * they issues other wpas calls. Yes, this is ugly but currently the + * only way to make this work reliably. */ - if (s->p2p_scanning) - return 0; - r = wpas_message_new_request(s->bus_global, "P2P_FIND", &m);