From patchwork Mon Dec 26 13:30:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Wool X-Patchwork-Id: 133234 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 3D7D3B6FE1 for ; Tue, 27 Dec 2011 00:24:46 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id A179A9C12B; Mon, 26 Dec 2011 08:24:42 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OqMadX9PlSDs; Mon, 26 Dec 2011 08:24:42 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 824449C12C; Mon, 26 Dec 2011 08:24:38 -0500 (EST) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id D7C059C12C for ; Mon, 26 Dec 2011 08:24:36 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xwYeuWi-F8P0 for ; Mon, 26 Dec 2011 08:24:33 -0500 (EST) Received: from mail-lpp01m010-f44.google.com (mail-lpp01m010-f44.google.com [209.85.215.44]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id CC5679C12B for ; Mon, 26 Dec 2011 08:24:32 -0500 (EST) Received: by laah2 with SMTP id h2so6969439laa.17 for ; Mon, 26 Dec 2011 05:24:31 -0800 (PST) Received: by 10.152.122.168 with SMTP id lt8mr19376467lab.12.1324905871208; Mon, 26 Dec 2011 05:24:31 -0800 (PST) Received: from Vitaly-Vuls-MacBook-Pro.local (c83-249-218-220.bredband.comhem.se. [83.249.218.220]) by mx.google.com with ESMTPS id pf2sm18986791lab.1.2011.12.26.05.24.28 (version=SSLv3 cipher=OTHER); Mon, 26 Dec 2011 05:24:29 -0800 (PST) Message-ID: <4EF876EA.1040207@gmail.com> Date: Mon, 26 Dec 2011 14:30:18 +0100 From: Vitaly Wool User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: hostap@lists.shmoo.com Subject: Re: wpa_supplicant's p2p wouldn't connect to Sony Bravia TV References: <20111202211734.GA31990@jm.kir.nu> <20111218182516.GC16415@w1.fi> In-Reply-To: <20111218182516.GC16415@w1.fi> X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Hi Jouni, Jouni Malinen skrev 2011-12-18 19:25: > On Mon, Dec 12, 2011 at 01:15:30PM +0100, Vitaly Wool wrote: >> so here comes the patch. Or should I post it in a separate thread? > > It doesn't need to be a separate thread, but yes, please post this > separately with a proper commit message explaining what the change fixes > and a Signed-hostap tag. > okay, how about this? From 115e721b88a5751ccb14a008b1c12da25a75af68 Mon Sep 17 00:00:00 2001 From: Vitaly Wool Date: Mon, 26 Dec 2011 14:06:05 +0100 Subject: [PATCH] Request repeated P2P scan with P2P wildcard SSID Currently if a P2P connection is initiated but there is no active session at the moment (e. g. a user haven't pressed the push button yet), wpa_supplicant will repeat scanning without P2P wildcard SSID (i. e. do the plain wildcard scan). However, some devices will not answer to plain scan while connecting, so even if the button was pressed on the peer device, we would not know it. This patch introduces the means to repeat exactly the same scan as the previous one, by means of providing a new callback for re-scheduled scan. If this callback is not set, it falls back to the standard way, so this change is transparent. Signed-hostap: Vitaly Wool --- wpa_supplicant/events.c | 5 ++++- wpa_supplicant/p2p_supplicant.c | 10 ++++++++++ wpa_supplicant/wpa_supplicant_i.h | 2 ++ 3 files changed, 16 insertions(+), 1 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 7913666..f67a716 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -814,7 +814,10 @@ static void wpa_supplicant_req_new_scan(struct wpa_supplicant *wpa_s, wpa_supplicant_set_state(wpa_s, WPA_INACTIVE); return; } - wpa_supplicant_req_scan(wpa_s, timeout_sec, timeout_usec); + if (wpa_s->scan_reschedule) + (wpa_s->scan_reschedule)(wpa_s, timeout_sec, timeout_usec); + else + wpa_supplicant_req_scan(wpa_s, timeout_sec, timeout_usec); } diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 5ff94ef..7b16453 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -2633,6 +2633,15 @@ start: wpas_p2p_join_start(wpa_s); } +static void wpas_p2p_join_scan_reschedule(struct wpa_supplicant *wpa_s, + int sec, int usec) +{ + wpa_dbg(wpa_s, MSG_DEBUG, "Setting P2P scan request: %d sec %d usec", + sec, usec); + eloop_cancel_timeout(wpas_p2p_join_scan, wpa_s, NULL); + eloop_register_timeout(sec, usec, wpas_p2p_join_scan, wpa_s, NULL); +} + static void wpas_p2p_join_scan(void *eloop_ctx, void *timeout_ctx) { @@ -2678,6 +2687,7 @@ static void wpas_p2p_join_scan(void *eloop_ctx, void *timeout_ctx) * the new scan results become available. */ wpa_s->scan_res_handler = wpas_p2p_scan_res_join; + wpa_s->scan_reschedule = wpas_p2p_join_scan_reschedule; ret = wpa_drv_scan(wpa_s,¶ms); wpabuf_free(ies); diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 5469129..29a30db 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -301,6 +301,8 @@ struct wpa_supplicant { void (*scan_res_handler)(struct wpa_supplicant *wpa_s, struct wpa_scan_results *scan_res); + void (*scan_reschedule)(struct wpa_supplicant *wpa_s, + int sec, int usec); struct dl_list bss; /* struct wpa_bss::list */ struct dl_list bss_id; /* struct wpa_bss::list_id */ size_t num_bss;