Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2560909pxa; Fri, 7 Aug 2020 14:25:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwULNwjR0JA5HNTKStEmd1B3xo2raVVzB+3uIXNKP91s/Y1J1nomzcve/CldIV/FlZvo4V1 X-Received: by 2002:a17:906:6ad8:: with SMTP id q24mr11112927ejs.192.1596835527943; Fri, 07 Aug 2020 14:25:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596835527; cv=none; d=google.com; s=arc-20160816; b=MqaFFVbospgJXMANZgP2e3b61gEWJ6Q2e7VMrEX7Ni19u2L4HdJguB//H6/yo0xWt1 vXAjIznCj334vCkdd7pIKBb4GRjdh/Afptpw957T1FMpJCIdApJekVkVsAkpcGqAOqjg 9i4aRlYzvrpGZNmNqWr7a1ktEYbinDsdB0eBILTAbvnX62oI9dHzADNfGQdb6noD+z+w t3DWVfKCdeB8VscP85h/dpEKE9Fu5OfWzPSPftkV1UZQ1tjvVn0XtKcL42HSUu/fokQo tCy3CFdbq52d52et9fmmRre92G8VPpxNW6xwYEJcPGKqHrVT6LrqRmLee98ZX6Sm+MOV qRjQ== 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=5wEq7H/aTNQaC+MLpK5FtBm7PEKzvcE/3MXY5TiR0Ys=; b=wFSPqfSCA9rAEYNJrs9LVKzlOrZtZo8sPe0FNZslQjHXrtp7Dseu3g79zb3KQuxLwA y9fn+Jv5Bdz86V77mxUIorR10Q1Wu+wJxAN16XMkFsaL+tjJkvXtKtu4fzfdGgBg5nN1 1AIg8WQ6IFLZg7VOBBQPJoikjukkXfSAe7KNbMPcw6uFtUse/VO6FGKfcNiLF1O8Uqdr mtUF0/gZe1UE3YlUEHswAXAHpfeMzc+BXGwUJY+FHKG+LoMSbsbFALfFm1J711q4deZA f+mSY+OIIHLSHYZozTwfpbaycxr96CsxANDv0s7jWio1c1IQ7FIp31bdjn1faWZsulNm g4IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YLTXn3KD; 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 f7si4203524ejf.687.2020.08.07.14.24.44; Fri, 07 Aug 2020 14:25:27 -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=YLTXn3KD; 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 S1725970AbgHGVYj (ORCPT + 99 others); Fri, 7 Aug 2020 17:24:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725893AbgHGVYi (ORCPT ); Fri, 7 Aug 2020 17:24:38 -0400 Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4BF1C061756 for ; Fri, 7 Aug 2020 14:24:37 -0700 (PDT) Received: by mail-qv1-xf49.google.com with SMTP id y7so2415445qvj.11 for ; Fri, 07 Aug 2020 14:24:37 -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=5wEq7H/aTNQaC+MLpK5FtBm7PEKzvcE/3MXY5TiR0Ys=; b=YLTXn3KDoWVX7zL61wg+vMsOZgSPtjTr51oWZbrLqqzqKyIfqXC4GFPtbCERqT1CCs VA+R71NO8RSRnNH9tH/ODzTAqhbP9PfQaUkVo1wEduD8mzCeGgiKxGvx6uey/1ORdHlz Z1IA5b/U6cxZJqSJyPnoabyei0tqTQEUlc+MNSTTefOGCd7A13ZZTavYw4EFAu1KT3sO z/OEzCawQ45+MV1OyrFgRcqOgbmpVw6euOovQ4zp7j2x1//iNIFAy8IvqGrH7oka3beI 7awR6Ix5LphIEfJni0C9dFzKDq6zGkgz3Y0aRHt7SmfxxxvCAcWFYlt81oRwuefX18ky fghw== 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=5wEq7H/aTNQaC+MLpK5FtBm7PEKzvcE/3MXY5TiR0Ys=; b=kLhrS+OBy7B+Gg/Ri5qzznwW/9a5Ci1p8Snb9D2oFfGKps8UUY1r6CFy36O8jxyMN/ ujDF2juTAuy4Wbxe4gWc7hS5Hn0btemVtxB0WkvQZKc6+cmp/2Oikfhbv4ZCAjxo0+K7 8p/lWYoe7vVs+/QskiYbjzoRQvfaNrkMQgnSUD0w6UONslP/TEqk/rXJy9nDxglxo5ob sJ/hs+TD6W/YqyYfOARf8GPZkei4weiLZlZQ7k3K5EPRpsJ+E/BoSS8d+eFAB9k0a14R qLXjMJaPea2xeZg9QzsUxUcqUD7PbvbQpnm3vK1n4pw0QRt6F2FhZZpkkqW4UWivZ8No AlvQ== X-Gm-Message-State: AOAM532Ye+kXcGlZy65Uqw2TJAy2nH+6HOCiyCFcJR6L5GBumhRB7r1s OKJTk8TzfD9ua74mIqXGgRrc6LF9SC9nrA== X-Received: by 2002:a0c:cc94:: with SMTP id f20mr16875759qvl.159.1596835476792; Fri, 07 Aug 2020 14:24:36 -0700 (PDT) Date: Fri, 7 Aug 2020 14:24:33 -0700 Message-Id: <20200807142429.BlueZ.1.I588558f1e38231193d6e955a4008ce54712d5c89@changeid> Mime-Version: 1.0 X-Mailer: git-send-email 2.28.0.236.gb10cc79966-goog Subject: [BlueZ PATCH] Disable auto-connect on cancel pair From: Manish Mandlik To: luiz.dentz@gmail.com, marcel@holtmann.org Cc: alainm@chromium.org, chromeos-bluetooth-upstreaming@chromium.org, sonnysasaka@chromium.org, linux-bluetooth@vger.kernel.org, Manish Mandlik 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 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. 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); + } + ba2str(&device->bdaddr, addr); DBG("Canceling bonding request for %s", addr); -- 2.28.0.236.gb10cc79966-goog