Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2477559pxa; Mon, 17 Aug 2020 10:32:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+dn449oUf+XVwubAEgDJ/bV2dIha2phLJLzgbre7RqQA4hR9fbWddSr40qeACARzfx87g X-Received: by 2002:a17:906:2717:: with SMTP id z23mr16314087ejc.19.1597685542598; Mon, 17 Aug 2020 10:32:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597685542; cv=none; d=google.com; s=arc-20160816; b=zdxiUrcq/GvshErLbVFqsDdKlu6DVAhxdBC3uEn5fhy8oJBZMf2tEfqnWKgufKrOjf o9CA3A6pTKAPV3AbFZWEL0oyn43Pei4E/tTtrGtaJDVuQC0NLHH8avHQMGu0sEReQne/ N1qlIncU6bJ+gX/S+D8HrIAbS2GJ7jmiRwVfgp+jboXehlBo1zWxtTSAvS4K758lHEOS eHkZZZqlH4EY/TzQxtBQMdQB0gnCYKsND0fD8t8LjB1mXBNOLPQuXQfa8SIBIg5Hi6dm gGNqw708alYekgBmtLwYzFEodDa5JqoQmDN4+15Lh4kZs8eTuJVpgrNH43MrFBtW6w4p V2dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=hWeNEkNfq1meNCt3Isl8R2a96rkFpIvROSVf2r++u2A=; b=be09rb28OEMoibsOE0T5UYlD777CElbP14FKAPgbMO6ME+7rOqf0on1j311a/M9Xnv V1WQ8XWT+oMw/z4TxOFon690xr5Kipwj5gVMd+abwTMwe0Iuxt2NTO8IDt84LTOkuZPt 5qKKJLYpQIHD1pJ1UZ+FAFI3GluA4hbbt2g4hRddptNzull0O5+3tgHJoVqIYYcKczT8 c2znQqQ11Pd7B9vu8JjUZeNpMs0dlqfeyzjyd10rNoNxFDS18qqTkFOsQtH4sud2k5zX APKNDMVoOe8jXv5RAHWYEkSRoSTz81CkgRoBlQEzAQk0TwNmbERGeV9/oHTguj3Dpr4c Oxpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DjCAvyXB; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u12si11713754edd.121.2020.08.17.10.31.40; Mon, 17 Aug 2020 10:32:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DjCAvyXB; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389340AbgHQR2R (ORCPT + 99 others); Mon, 17 Aug 2020 13:28:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730731AbgHQRLS (ORCPT ); Mon, 17 Aug 2020 13:11:18 -0400 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80FA2C061389 for ; Mon, 17 Aug 2020 10:11:18 -0700 (PDT) Received: by mail-ot1-x344.google.com with SMTP id h16so13992944oti.7 for ; Mon, 17 Aug 2020 10:11:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hWeNEkNfq1meNCt3Isl8R2a96rkFpIvROSVf2r++u2A=; b=DjCAvyXBrXoVKz4YVQc7EDwas/ts6H55sPx9ZggebnplYs2N1tiY10AoS6GtOWRX6+ POMXgrOLVnnI8fmA5UYWze2KPq/zwFZkHGMBsx70p5BUbMtpFkhFmNFc27SPwoUJlSiy 1Fo2pabsGey1lvsJmMTrmcrqrKJVCzp14qEcIxfhnUuPOMmX2NqBJUnBRHu6pNA0SkRC 2u3bBsF+QhSnbXyAUXyhAy8s1bmd3ZklRxfeRxLbqn3Ltj8r0ffLiYUZOfyZvLRtY7de 7vkAL11ZiBcTROgUVaGvRzNg7CiEm8mPUB1EluSX2k7f+66Ba3g+aKh/b4UED2kZcDk4 KmIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hWeNEkNfq1meNCt3Isl8R2a96rkFpIvROSVf2r++u2A=; b=L8uzZDVRcUFrCAyxGbACQlGU4vEysB/DmFB7CjDPfV8wdQx3xFBV8xIWvxVBNU81Uo jEf5uxf3oXZGJ2FiAaSVMX+WN5/GL9YCtLGI1RrQ7J895J/m6X3h9ngGHecxr8IhxajH j1fYn+3gap2HgX/QcsZ11bwTfyN/RxgIycnqYKUFIxWzF2p8EtAsRlKC7WOzId3QXN6g SaRZ3kVD9EYY6DIlDrPhOfJl2pCur3S07kxISi+GIdGI2kXfucxPW8JTfcAJ7WaBxC+Y w92Eel14xcsau4ICmxUFzRjiRHyEKEX5e2s+sX8/OQiOlo1WDVufIqVqzOHDZrnG2cqc gmWw== X-Gm-Message-State: AOAM530LrRmEEsh52jyEHIYGkthxh8QqDrEXva7nhC/5XyRfNImPKEuN U9TCiSXzeXfJCmBhtj1gzVdZdlZq2UzgTbZ3+V8= X-Received: by 2002:a9d:6053:: with SMTP id v19mr11500633otj.362.1597684277869; Mon, 17 Aug 2020 10:11:17 -0700 (PDT) MIME-Version: 1.0 References: <20200807142429.BlueZ.1.I588558f1e38231193d6e955a4008ce54712d5c89@changeid> In-Reply-To: <20200807142429.BlueZ.1.I588558f1e38231193d6e955a4008ce54712d5c89@changeid> From: Luiz Augusto von Dentz Date: Mon, 17 Aug 2020 10:11:07 -0700 Message-ID: Subject: Re: [BlueZ PATCH] Disable auto-connect on cancel pair To: Manish Mandlik Cc: Marcel Holtmann , Alain Michaud , ChromeOS Bluetooth Upstreaming , Sonny Sasaka , "linux-bluetooth@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Manish, On Fri, Aug 7, 2020 at 2:24 PM Manish Mandlik wrote: > > While pairing process is in progress, service discovery starts in the > background. If HOG profile is detected, auto connect is enabled for > that device. This causes future advertisement from that device to > trigger a pairing even if the user has already cancelled the pairing. So it looks like something is not right if the user cancel the pairing process I would expect the device to be removed if this happens when setting up a new device or at least call Disconnect method which would disable auto_connect if the device is not trusted. > Reviewed-by: Sonny Sasaka > > Signed-off-by: Manish Mandlik > --- > > src/device.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/src/device.c b/src/device.c > index 470596ee4..ab5bb123e 100644 > --- a/src/device.c > +++ b/src/device.c > @@ -2870,6 +2870,15 @@ static void device_cancel_bonding(struct btd_device *device, uint8_t status) > if (!bonding) > return; > > + /* Auto connect may get enabled during the service discovery even > + * before the pairing process completes. In such case, disable it > + * when the user has cancelled the pairing process. > + */ > + if (device->auto_connect) { > + device->disable_auto_connect = TRUE; > + device_set_auto_connect(device, FALSE); > + } BlueZ has the trusted property so upper layer can actually flag if the device is trusted regardless if it is paired on not, so this seems out of place or we should at least check if if the device has been marked as trusted. > ba2str(&device->bdaddr, addr); > DBG("Canceling bonding request for %s", addr); > > -- > 2.28.0.236.gb10cc79966-goog > -- Luiz Augusto von Dentz