Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2666610pxa; Mon, 17 Aug 2020 16:01:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyr9Bk8/5N80rONGMVx4gHrQhPq2YpffyOlruajGf6WyYdvkkhHLn/xwnmZqRqMVmPtWi9q X-Received: by 2002:a17:906:7e0b:: with SMTP id e11mr18353760ejr.540.1597705315497; Mon, 17 Aug 2020 16:01:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597705315; cv=none; d=google.com; s=arc-20160816; b=JCYsHeLe/HqGY/8yHFpm82TbpFD3xRDJxHRnQvdweyBBdCLMipdyPny6QBgaPFpHQT fARbzySTNfUE77gnjdQDimU+zQQX7xtgT/f+3gw8SrfLD8NcLALzxi0p+K7SVEsF09m2 mJdCP0o7FNamQEdy8YV5KUne2qt/Yh+7vcmRnm7xbXsvsjB3F2pxZXRVtLmJmdPRvLSz EPhaSxcREwEKi91tOYDvAjDBSAqvtfhTWl4A4ZiQUTwXWUq0gENpuX4YtczsIqNpu0Wz BN9kjaK+xjCXFZJtmjX/RityzxY9irrRXVF9g7vvHQ2C3Bz7WJl2NEpIP3XE0zefZdWg zPhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=xAuvgih+72j9IUIm7iDAaTRlM7+svjQwxUff+8aUj68=; b=gTMipJaJIyxAgzjaMDFbHbySqy3dVXyeLldn821A73tIq9KiPdLkvlNrzukd+XnJlQ NFqCndS02BckXly6MoXkO8LFnoZ7MpwSFm92sP3f5pyD/kuyZ+/0ekDM8ko2ETHDlCu8 d1nXmlFD5AsjRjpu80rXvww7cfZ/a42G7/DQEh5LxuRZgcscOkqALi0ECKZcoIHfW74d /UOsijZORUjamBOKnCuyaJgwLjkY7aUea5eX+TZRaa7xeeAYx3vJu2Nv/cnLvsoK97j4 TwWp44LxPZWqeGgyD+MIgBI4NUOv62nbyLCBlt05sjHqXtV1WDMpNdmKVJYpmrPEBLvM fYKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=TNurjeIA; 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 p16si12191875ejb.342.2020.08.17.16.01.30; Mon, 17 Aug 2020 16:01:55 -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=TNurjeIA; 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 S1726982AbgHQU43 (ORCPT + 99 others); Mon, 17 Aug 2020 16:56:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726228AbgHQU42 (ORCPT ); Mon, 17 Aug 2020 16:56:28 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22469C061389 for ; Mon, 17 Aug 2020 13:56:28 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id v11so19666400ybm.22 for ; Mon, 17 Aug 2020 13:56:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=xAuvgih+72j9IUIm7iDAaTRlM7+svjQwxUff+8aUj68=; b=TNurjeIAgdwM1HlUV/65hI/+Ydcs0nHzExOPJdZ9NkaFFkq6jQaJgeoMQMNf3jXjod p1ihIIXKAre3BNmA4+hoRwzkmri2+zsiM/2px4AYw2YTKQxpa2TQJtHntfkIOzJCBto0 gaiZNNeD24fCr2z5DYVCaUMRdwwJKBeGmFc6S/SvAdINxQq5s4xSPDgh7G3AhAISAIl3 z1F6hbrv/UBmM+L02X5q/z7tojQ/5x+srPNe81kjblXMiXFHSV+UguzGLPOPT5F1cbUL O47ract8E0WckuOZ2uSuIHjtt8cPb3AV7nQcB36vglDw/29yNP/zsut3zaS8ZsNnykiK UuLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=xAuvgih+72j9IUIm7iDAaTRlM7+svjQwxUff+8aUj68=; b=Z9OyrGrSgeHfIeRnof7cgf4r+jZ5f3mmibnYrXRQbeUxjHC6Zp6oVfGYrPMCdwvsIp wBfUUfMNjOaf3hXQ5d2fcn61uCrDC3gSYsv8UqoN823VsqTrd4Px2QcXpoO8dkUapXQB QWMf24P8Pg8ZeWcbQ/CNtbpmKt7YGWd0PaxohCgopESe2zYjlfDam8ECqZaAqT6I0nd0 G0Hxkc3WlXhNgcB9w16HYrCRi9RiNtZsztCXB7GuJyUgbvz6y94LoHo8vfHD/2pzygVE Br1ieg3iF0RKB78J/M5dk4KLyQzdERpSPOLkGbqWqc75QVKVxZA4zuq9TMmLZl4dApgo OyIQ== X-Gm-Message-State: AOAM532YOiewqtorFw9qwUcllRj77R0HOod0wGdajhk6NZpmrEAdnTm/ C/9aTI3/3YoKHmoYJz0M+GWgCxFfcMR4OlarXS0gE65/3IhY3Kn5UnNQtYOq2/krIeZE9FtB9KK smhgLzEjRb6TqYhcg5LDGFWsZGId9kYUPizdP/WhuLn5PkIst2AhhUSz2r0kVH5rDzz+5OFtI5g dk X-Received: by 2002:a25:40d8:: with SMTP id n207mr24159973yba.69.1597697787315; Mon, 17 Aug 2020 13:56:27 -0700 (PDT) Date: Mon, 17 Aug 2020 13:56:23 -0700 Message-Id: <20200817135606.Bluez.v2.1.I21d21871d85db48b07ba847742c7cb933024307c@changeid> Mime-Version: 1.0 X-Mailer: git-send-email 2.28.0.220.ged08abb693-goog Subject: [Bluez PATCH v2] adapter- Device needs to be in the temporary state after pairing failure From: Yu Liu To: linux-bluetooth@vger.kernel.org Cc: chromeos-bluetooth-upstreaming@chromium.org, Yu Liu , sonnysasaka@chromium.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 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. + if (!device_is_paired(device, bdaddr_type)) + btd_device_set_temporary(device, true); + device_bonding_failed(device, status); return; } -- 2.28.0.220.ged08abb693-goog