Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2685959pxa; Mon, 17 Aug 2020 16:38:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx45FNMhbuFQ0SxsRTKzDAusHy/PYQyo4BhjT6KkHnbe3Yc9pbzHlpm6+g7Vl9dS5iBH95T X-Received: by 2002:a05:6402:22d5:: with SMTP id dm21mr16797199edb.211.1597707490526; Mon, 17 Aug 2020 16:38:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597707490; cv=none; d=google.com; s=arc-20160816; b=JpJ7xVKKmMypi43DH8a9u9D2zvXZSLRCShQ06InoCRiM0y8qTKjkRSQ710sInRfzws j+SHUypRXBhaWp5GRBiLRCmTbeob4LRJYECcDX5/AkCfLELXjwr3hY6MJBsfl0We+uTE BqKq6d1EDkVfJKGZQW9FxU/IQJxtmKfOELrg/u18ZjQ1xdjL1asykj7RiyAN5JXEUift hGchGheS5P0ChAf5izmUixhY3vfAOnfzFOAJldhd5/tzsgM6ac49+E1zVk2aIhtPJjFj omz6Ae81Xej87sMFJLIa7IIlKSozmQsGQYLZSOacuZhsoyweo7nbu2x1inCWw2QTPOvz FUwQ== 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=dlqDKlV9jk1FHSuh4MPTcik7VEPdRAvdq288sP9/ibE=; b=uHR0T+LgFF8yZ0kdwEZTcbO8fR0BFyiJTmbPqe1w8zzFPVf3HfVzbgCAPRk+J+BfQ4 Mqy5iGqXHhyGXVcMfPxTxt8rVEl9Mf4ou+96fYmcNCgoAJZCyRNFKOzP7C2h4tyO/fRh 4vr7cQ3iXIfbwm1n4VZmd8N6xNiRh3zzJbS+M5WdhFZayz+EHrWypPFMjN1cGMBiZuKt y8+8Gc6YibyZX5d6ZrlVKXNYX1c3oVBUnTR11B9tDE8vHJpAEh3161LionhimHjbhsvO L+iGvkin5ZMviXTNFtDJBtVW01qq/z3J/ClN0pOHqklZkL/PArLYde8ZWYlNuBstOJgY 2sGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=QLqHppGV; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n12si11717215ejg.253.2020.08.17.16.37.35; Mon, 17 Aug 2020 16:38:10 -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=@google.com header.s=20161025 header.b=QLqHppGV; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726302AbgHQXf2 (ORCPT + 99 others); Mon, 17 Aug 2020 19:35:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726272AbgHQXf0 (ORCPT ); Mon, 17 Aug 2020 19:35:26 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 120BEC061389 for ; Mon, 17 Aug 2020 16:35:25 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id bs17so13784391edb.1 for ; Mon, 17 Aug 2020 16:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dlqDKlV9jk1FHSuh4MPTcik7VEPdRAvdq288sP9/ibE=; b=QLqHppGVp1eQojtphbbWnTL+NThZ2dTAOnw8dw+kLbnpLGSQhbXbu1S9k0T42YIUYm x2hMFwL5FTnuiDuVu9aW/BRG/PDe+YEk1UaQtCQRsbbh01n8kfM5JXsek9UNceDPmEWQ w0Wu8RtVjn56eUD5fCxTIDgFd44USnDwsR29iWlJ7/zAzcOibxlzk76xOzDX8SCe2meX TZPPk7T7VyUPgmLgMf6WSdr4kcv1uPPuGrdZzSsPegXFqtSxI5GL0Wkjycp9EQKepmyO 6GsTLELkUpalyjfAV9TRK2VDQAH/eQSQnvRzsIgBWBj5Q3Qwso6bHLVjNLUHoU0MjGzI KNvA== 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=dlqDKlV9jk1FHSuh4MPTcik7VEPdRAvdq288sP9/ibE=; b=a/c8W+ywDdGwTz+6fTSlqCzWr+99F4Yo/uWwOqQG8fZgyASfrD1NRKCG1ILvE7XU77 XGtJgWUIFX+LDPJD3apxh++VYN2JBNfI63ULfU/CEeQtY7oXK0qOjy2o11235ICmE4cx 0VmVF3dS5zrWOSG4BdUJZMlPUYBmRFTXnYnzmmKnO8UY6+KRA9mCv+7bTzOR7IVfObIK 857ECAGg745L7wH1isTZf7fTq5nVFf2hbRu7Df7XAz7XniblzhcVjt8HzRYazg2wigK1 PC2msDwO+nSHmr5nnSBXlLBJspS4Np5dJ/sOyzeq6O72wWBQv5WEwEen1u0220zxklJC KiXQ== X-Gm-Message-State: AOAM531l3O8u2cqEX2k/45nwC3jevZvqKlhWNYo6tCLZCrlKCDyO+wi0 jfs/OK7USFnH6fluC66PCVpWrzKBaZWLyxaJpHhfFg== X-Received: by 2002:a50:af83:: with SMTP id h3mr17386293edd.139.1597707323481; Mon, 17 Aug 2020 16:35:23 -0700 (PDT) MIME-Version: 1.0 References: <20200817135606.Bluez.v2.1.I21d21871d85db48b07ba847742c7cb933024307c@changeid> In-Reply-To: From: Yu Liu Date: Mon, 17 Aug 2020 16:34:47 -0700 Message-ID: Subject: Re: [Bluez PATCH v2] adapter- Device needs to be in the temporary state after pairing failure To: Luiz Augusto von Dentz Cc: "linux-bluetooth@vger.kernel.org" , ChromeOS Bluetooth Upstreaming , Sonny Sasaka 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 that could be a reason and a potential fix, we remove the temp flag in dev_connect and pair_device very early on, but i suspect changing that would potentially have bigger impact and needs more due diligence and testing. On Mon, Aug 17, 2020 at 4:24 PM Luiz Augusto von Dentz wrote: > > Hi Yu Liu, > > On Mon, Aug 17, 2020 at 4:04 PM Yu Liu wrote: > > > > This caused the device hanging around as a discovered device forever > > even if it is turned off or not in present. > > > > Reviewed-by: sonnysasaka@chromium.org > > > > Signed-off-by: Yu Liu > > --- > > > > Changes in v2: > > - Fix title length and format issue > > > > Changes in v1: > > - Initial change > > > > src/device.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/src/device.c b/src/device.c > > index bb8e07e8f..93e71850c 100644 > > --- a/src/device.c > > +++ b/src/device.c > > @@ -6008,6 +6008,12 @@ void device_bonding_complete(struct btd_device *device, uint8_t bdaddr_type, > > > > if (status) { > > device_cancel_authentication(device, TRUE); > > + > > + // Put the device back to the temporary state so that it will be > > + // treated as a newly discovered device. > > Use C style comments /* */ above. > > > + if (!device_is_paired(device, bdaddr_type)) > > + btd_device_set_temporary(device, true); > > Hmm, are we perhaps removing the temporary flag too early? Or this is > a result of calling Connect which clears the temporary flag? Then > perhaps we should at least if the upper layer has marked the device as > trusted as it should indicate the device object should be kept even if > not paired. > > > device_bonding_failed(device, status); > > return; > > } > > -- > > 2.28.0.220.ged08abb693-goog > > > > > -- > Luiz Augusto von Dentz