Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp301043iog; Thu, 30 Jun 2022 00:41:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1soYYAx8soWS59nVbkscRiTyClrAdLUS0Ete6+dRQApmdD52v9Qd0Ra/lsTKTLmYE9zzIZu X-Received: by 2002:a17:906:478e:b0:722:f84d:159f with SMTP id cw14-20020a170906478e00b00722f84d159fmr7621664ejc.182.1656574883282; Thu, 30 Jun 2022 00:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656574883; cv=none; d=google.com; s=arc-20160816; b=GkpPUz4DLqavTGIQPJrwdqY1ld2wm7TunGbzMccazgwMZak58i6R9UNldmZaWrwtkY 196OUbHweGXzHpex1BjTpOC4DXUQoZAl4H/I5Z8uU+xcKbo+0KLMmyJzb+M4Q8lWTXRB ZadPwEQNT8igaMHWYbJV7Wspx0kGTD3UOeh4JOj9UahD8CFom10tArJ3/BoXM3mQc6xd GEONc5iC2XHXX9zRtgmu62qo23Eyk7XErIYrKD7nTEGqGTLAXfVUdqW6P2UaqC4E0G5i PuQqlLs03f2h/PLZoW+oJGqL8O1yUq1ttyRooux3oRSUMxpBmqNfxnjtnzW280h+gGI2 Pd6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:feedback-id:dkim-signature :dkim-signature; bh=4RjzQkICd6JShLQpf6JLO602PG9BdxNyoon3ms2HCpg=; b=iYPcftQNMIgKh2FpRz+3d317+Fp4lN3PVBY9QxpyBVX5jC+ldLTKh71f9/sZwxbxR5 LMyxMkTQy5GyBHzGNdNSJwzdLqCrPl0JTiDF7O6efimGhibNZpjehER/IXqYlRaLOJoR Sf+mqkJr3WuOZzTnFHoXZOuzl2h2QnG6Gb+Us/O7wEs/uvDGgmizYpwUAXNzalFvVxab RTb6FsSfnKaKWPn5uVLhk4R7Zaum4hYSS+doIE3RK2lzXNBdE5hnT9XLw22epK7jWRcy BbDwD+a1IfL4JbbjMRexLfvOyOHR6xME/Ov2i1X8p+m+xr5rpT7BbFQJDiRCBxB2q3+W RWfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@adrake.org header.s=fm2 header.b=TpGYmn8u; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=b99zl0qx; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=adrake.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b6-20020a056402278600b0042e1708c0ebsi6955726ede.579.2022.06.30.00.40.56; Thu, 30 Jun 2022 00:41:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@adrake.org header.s=fm2 header.b=TpGYmn8u; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=b99zl0qx; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=adrake.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232473AbiF3Hkl (ORCPT + 99 others); Thu, 30 Jun 2022 03:40:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231572AbiF3Hkk (ORCPT ); Thu, 30 Jun 2022 03:40:40 -0400 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 291C43A73A for ; Thu, 30 Jun 2022 00:40:39 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 79BB55C01F8; Thu, 30 Jun 2022 03:40:36 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 30 Jun 2022 03:40:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adrake.org; h=cc :cc:content-transfer-encoding:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to; s=fm2; t=1656574836; x=1656661236; bh=4RjzQkICd6JShLQpf6JLO602P G9BdxNyoon3ms2HCpg=; b=TpGYmn8u+3UHzo+Ze40VKHbwgK6HnpDhBQ6EyDcdw nq0791CYVg+OC3T84WvVXF1fJrQWTTkorvIodLYyBoBqD2jco4kBCWn/bVBLqxm6 sl3oiIbz3DO/aSoP0+6NU2DyfNr4LDqcoWPLXB3slkIS/IAQjep4qbCl4GLr8L95 a6u3qPQMmFjJqxIUcr/upd85n7XSDfqNBc9gD94aqtNEaWOlwS+4Kmd9alp68C3s VABo4mWK0N0mg5mkdcZ7q22+5iGsqiyhZeOY9ghj+hOYjfosZebnw/Lf+2pdbz94 6fu3bXqzNVcgu4np5Pw7PAZsGkMbpX1JAmD0i91S8SoUg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1656574836; x=1656661236; bh=4RjzQkICd6JShLQpf6JLO602PG9BdxNyoon 3ms2HCpg=; b=b99zl0qxz0UbwTJO2gIGCaYOF6/oxUGLtijr1dhVXSh5ydb5688 ybcpZsWjgU1tZfw1uLrTckyx39V2xxaFseUgzOtjh3LZCdEpCkGLQg1XtfEB1756 rIh2XgCL3AuUPGFs4ZWjtogQlhm5kLSIFQd8m3hzwU9vHi0+72KbxHb4KShfFJt/ r+/nxVYZ0vxWSXvNlkuI06mOoV2wSBaddD1KuuNrryYbeRrozfzoeivDPyPpaEcv 0Q3AZnseWLRCCB0V2AaJLDE+f5/fvJBjn6gx9MrihnSqqVyB4VzCBZEDLptikUrl yQNvPzhWMkHjP1+icRKp8Gkp6Fo/0h1LEIA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudehtddguddvgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvvefufffkofgggfestdekre dtredttdenucfhrhhomheptehnughrvgifucffrhgrkhgvuceorggurhgrkhgvsegrughr rghkvgdrohhrgheqnecuggftrfgrthhtvghrnhepueevvdfhteetjeekudehteelffeuud evffeggfevleegffeitdefffffgeehtdegnecuffhomhgrihhnpehgihhthhhusgdrtgho mhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrug hrrghkvgesrggurhgrkhgvrdhorhhg X-ME-Proxy: Feedback-ID: i7cac4098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 30 Jun 2022 03:40:35 -0400 (EDT) From: Andrew Drake To: linux-bluetooth@vger.kernel.org Cc: Andrew Drake Subject: [PATCH BlueZ] adapter: Fix advertising monitor on Linux 5.12-5.17 Date: Thu, 30 Jun 2022 00:39:58 -0700 Message-Id: <20220630073958.34468-1-adrake@adrake.org> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org The existing code assumes that, if a device supports advertising monitor offload, DEVICE_FOUND events can be ignored since the kernel will send ADV_MONITOR_DEVICE_FOUND events instead. Unfortunately, these new events were added in 5.18, but offload was added in 5.12. This patch adds a check on the MGMT API version so we can process the older DEVICE_FOUND events when the new events are not supported. Fixes: https://github.com/bluez/bluez/issues/357 --- src/adapter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/adapter.c b/src/adapter.c index 16da20034..62ca42ffb 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -6909,7 +6909,9 @@ void btd_adapter_update_found_device(struct btd_adapter *adapter, bool duplicate = false; struct queue *matched_monitors = NULL; - if (!btd_adv_monitor_offload_enabled(adapter->adv_monitor_manager)) { + if (!btd_adv_monitor_offload_enabled(adapter->adv_monitor_manager) || + (MGMT_VERSION(mgmt_version, mgmt_revision) < + MGMT_VERSION(1, 22))) { if (bdaddr_type != BDADDR_BREDR) ad = bt_ad_new_with_data(data_len, data); -- 2.35.3