Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4277506pxb; Mon, 27 Sep 2021 13:18:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQFHzh29qm0ZLB2kiEyrSZjT83GB6ggSqOCoVS8tZqpTdaypKGcYH+mzoG5EZ6yBCLGJA/ X-Received: by 2002:aa7:9816:0:b0:447:bdf9:eac2 with SMTP id e22-20020aa79816000000b00447bdf9eac2mr1791875pfl.31.1632773886667; Mon, 27 Sep 2021 13:18:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632773886; cv=none; d=google.com; s=arc-20160816; b=IveNjhaiCOFi/nEVNhlRDjneDxx1cWfPAwzVjoDhGoq1VdO0Ci4ewN+vzyf05QXGF6 UmvjUCkxzpI1bMgtphp2aNCyg3pAZnTKJz7wDN4mhiE4kxwefBy/dG6bX5r/ODse13na Ol2kUGg/crcmumi9Fk+dyDC2iBfyFX809SlRAXCFAn3jeagXZyb4StWbvL9Mthi5knBy 29Dpcqkeveqosn0uXB0Bu0zuTfXiPdLpLPuI5Onrdsn2BnzI1CNs8OI0At8I41DEtEEO OcqYn+4oZ3dVwZk08SZeZvDWJf6csxPu4NhfcayTesl45xrYrcyhSdvO6MS/E81QYPjr mb2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=rzTIu1JoB+uKHekR8/Dw77In6oKArKQgMAGVIKHvT64=; b=zDPpdzI3rxGEsQuWUmooBPVTD+qGqahbXV2HNVGk8jro2b0IMZuk5sLmniHf3CR1pC 6PjlW6eHp8/477O+KJyLezSEy2Hteb/rEIRO9TAGH/hy4n90TPT4JyTd1oPFya2MeX1W nMUBOt8JsrqWuGdsy7MriAAAkCzgk1gxzJMWkxmVxO3RpD9HoRLjE6PlUHwynkw/qv6H l6erBhpM8PTgUwGdTdzCrO1jn4U4M7Y29fctdaDJBjF16nBc6yeFVhWP+mQNlyNhExOs 6RhkWrnKEYUJmg9i0L0bhysunH7UMVyzOHOB/rCEdEeo+2fKsH6sVz5s1a1PkMFmeg+n Tucg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=s2jn2oYi; 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 p5si6013805plo.204.2021.09.27.13.17.53; Mon, 27 Sep 2021 13:18:06 -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=20210112 header.b=s2jn2oYi; 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 S236889AbhI0US6 (ORCPT + 99 others); Mon, 27 Sep 2021 16:18:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236921AbhI0US5 (ORCPT ); Mon, 27 Sep 2021 16:18:57 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8619FC061575 for ; Mon, 27 Sep 2021 13:17:19 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 81-20020a251254000000b005b6220d81efso16160570ybs.12 for ; Mon, 27 Sep 2021 13:17:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=rzTIu1JoB+uKHekR8/Dw77In6oKArKQgMAGVIKHvT64=; b=s2jn2oYi+1Ad+zeEmTxtbT20c5gUTbyaShzfn4zXSK45HWu7K72qcWG/iIbx+gaF0v Ee9lNoPvSbBPcfon0J4XwkDtdUnQsmqydEgn5AuSzr4wOzdn8AVcd+JpkSCF9t+okp+k XIGKEfHwOG72M9Vg/hZLQnZGs7gE1q5LYxqGeqCv02N0pIxmdPnIzt5RSs2cjCRd8q0I tI03/JYQCx6KFbGACu05v9XfTExBohqApvDqe4QZ5Wdrpsmkl/USMpwDEbY7AJp/8dqK H7+qkpxbKPN9evPHqtB1i7jFZZkaURShkCvkj3g/R3gD/GrU6EecujWq9fc5wIACM6LS +Q7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=rzTIu1JoB+uKHekR8/Dw77In6oKArKQgMAGVIKHvT64=; b=g2V1xo3tSvzwAfSRlLShkutg+O5HdRBO8E5MR1tSjcgf+v8xyuLBfmaQeuVTZf6RG1 bfvvRTltmfLh3o1p4wo1yTL8zNmKBSvLlUTWFhQ2aikukkaSOzx0skJgeVUtN/tdJNI5 n4IuB9LgCmYFEqFWV/elTpzW+cy0HIDNxE6sGMl/62zfCE4ZcclvNigjAY+beU4txR33 0pr8G/w9yuXYrryYjfMI1gI0PqoFQNCuq4rO9C2E6ORDJvDllp7EidJFTO71lPBgV+Rt CY1W+L+2bhgSTsqzuatC14Fmb+nn1wgpmGPyfDBr3WieJ9SrqjFkq3DOdCxhDz6BlDs1 f7zQ== X-Gm-Message-State: AOAM532DguIqGH7gBqgjKYTPmVYdKJd4OqrbFC0MdKhGAoMvRGygQD0L PtYPoYnxg8C5qPhnsbm2bLHk7AJX6NXIxQ== X-Received: from mmandlik.mtv.corp.google.com ([2620:15c:202:201:8f29:89eb:dfbc:3b00]) (user=mmandlik job=sendgmr) by 2002:a25:5e09:: with SMTP id s9mr2082275ybb.417.1632773838776; Mon, 27 Sep 2021 13:17:18 -0700 (PDT) Date: Mon, 27 Sep 2021 13:16:57 -0700 In-Reply-To: <20210927201657.593569-1-mmandlik@google.com> Message-Id: <20210927131456.BlueZ.v1.3.I68039747acc3c63f758278452889d6ed2bfff065@changeid> Mime-Version: 1.0 References: <20210927201657.593569-1-mmandlik@google.com> X-Mailer: git-send-email 2.33.0.685.g46640cef36-goog Subject: [BlueZ PATCH v1 3/3] adv_monitor: Receive Device Tracking event From: Manish Mandlik To: marcel@holtmann.org, luiz.dentz@gmail.com Cc: linux-bluetooth@vger.kernel.org, chromeos-bluetooth-upstreaming@chromium.org, Manish Mandlik Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This patch registers a callback function to receive Advertisement Monitor Device Tracking event. Test performed: - verified by logs that Monitor Device is received from the controller and sent to the bluetoothd when the controller starts/stops monitoring a bluetooth device. --- src/adv_monitor.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/adv_monitor.c b/src/adv_monitor.c index 715ac5904..05bd49134 100644 --- a/src/adv_monitor.c +++ b/src/adv_monitor.c @@ -1531,6 +1531,27 @@ static void adv_monitor_removed_callback(uint16_t index, uint16_t length, ev->monitor_handle); } +/* Processes Adv Monitor tracking event from kernel */ +static void adv_monitor_tracking_callback(uint16_t index, uint16_t length, + const void *param, void *user_data) +{ + struct btd_adv_monitor_manager *manager = user_data; + const struct mgmt_ev_adv_monitor_tracking *ev = param; + uint16_t handle = le16_to_cpu(ev->monitor_handle); + const uint16_t adapter_id = manager->adapter_id; + char addr[18]; + + if (length < sizeof(*ev)) { + btd_error(adapter_id, + "Wrong size of Adv Monitor Tracking event"); + return; + } + + ba2str(&ev->addr.bdaddr, addr); + DBG("Adv monitor with handle 0x%04x %s tracking device %s", handle, + ev->monitor_state ? "started" : "stopped", addr); +} + /* Allocates a manager object */ static struct btd_adv_monitor_manager *manager_new( struct btd_adapter *adapter, @@ -1555,6 +1576,10 @@ static struct btd_adv_monitor_manager *manager_new( manager->adapter_id, adv_monitor_removed_callback, manager, NULL); + mgmt_register(manager->mgmt, MGMT_EV_ADV_MONITOR_TRACKING, + manager->adapter_id, adv_monitor_tracking_callback, + manager, NULL); + return manager; } -- 2.33.0.685.g46640cef36-goog