Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp842862pxb; Tue, 19 Oct 2021 14:19:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlOCCDAgOz3UFcaj7ZEtrx36vRp0gBp8t7H6Dp5bJaa1VFWJNc5m8Y/7RakCf2zwq8QtBf X-Received: by 2002:a50:e183:: with SMTP id k3mr57945044edl.22.1634678387151; Tue, 19 Oct 2021 14:19:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634678387; cv=none; d=google.com; s=arc-20160816; b=MiF/QfnTg7SNhb7Cp3vj8fKr3FVr4mKhI87TT4b0/bDP5PAowQk+wfDGGN+Rdctkk0 E3Y/zy+PHSB+TPLVxtOGnlSYn3jWD8VXcGwGMnglCKLtrDeUhXJ1X6uBWPWsKzPzMCCH 0FGuPYllQe2TqEh3EaJti5IphWfFuYgLDwDSpN0YJr8ca/LQjRL5F1yUG6VA41NrINXH zTbHoF2y3NnxgmuXrWY6Jiy25Nb6p4Ug0clVk3IrW6hFfPdi/fsewT79j9IU87QsLajb bRpzoCalSVwYcoig5BGWxdEHRjsT0iV8sJNfw1wxcOzreeTPMTD/7/PJDULoyZIO7I2F 6M5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=fbIhq0CHxYNjhfi4w7ry3tJI6g5AZi4JJSy/6O2ouH0=; b=rhdUV5y6kHRBnnURemw0PGIE9R/DRzBFz0HYzjs/y8T76CHWOdAKheQAY1lYYPCoXQ 7aXKHNp48d+iulTSwp53XWco++z3iEF/eiYdT+koa/InrpdIpzlXD78cltaZ0KIyoXRZ 3wqXrDBs09ZbKhCwqS8dmu24xdxUnRjMpaSfcpSoa11aLvvnprXpuhd9mEBLaMfeHgkk FDEGRJ9fAmiUwSqFv1NV4DPhSKKOSgUF/dRO/7GP4es2dgPJy85p/fB9YJ7xb56ve/RK PkpVMUIg1ZLw41p1hk7DVpkYXCAbmmb0zE1gDBlNr3VY8g5XxL00InrL6oIHI2nOncs4 77pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cGW031Xm; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u1si342799edp.348.2021.10.19.14.19.22; Tue, 19 Oct 2021 14:19:47 -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=@gmail.com header.s=20210112 header.b=cGW031Xm; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229668AbhJSVTx (ORCPT + 99 others); Tue, 19 Oct 2021 17:19:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229625AbhJSVTu (ORCPT ); Tue, 19 Oct 2021 17:19:50 -0400 Received: from mail-ua1-x931.google.com (mail-ua1-x931.google.com [IPv6:2607:f8b0:4864:20::931]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C5E8C061746 for ; Tue, 19 Oct 2021 14:17:37 -0700 (PDT) Received: by mail-ua1-x931.google.com with SMTP id i22so2653006ual.10 for ; Tue, 19 Oct 2021 14:17:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fbIhq0CHxYNjhfi4w7ry3tJI6g5AZi4JJSy/6O2ouH0=; b=cGW031XmaphQLlIQ2Nc0U8Y8u09MyxCTHlqObLgm/cE+pNc97LEZxvyQmaO7X6J3fB njpQtaEETAAvaO+qo8jHvBRIYzsesIRd6gHby9mdRz6qFJXBbBMgWDE/CW10h9s35chL 2Rf3EdU5gjtGqs00uZs2fuMzpFLwrVrLGAX68ScO27jfGg84ex9EBGBYJcLcmPVP8p1y c9nimZ53ulQ3PZTibteIADpVnzNL3IGz449KWPVqlXmkd5vw2RebqYNgXJMKXPjz9idn TuORgoqB6z2gxjRFlx01ppaEHv2ZJob3fZVhGzb8v8t/QL7/ZwB3gqa0uRgdnJZowJcD 7CPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fbIhq0CHxYNjhfi4w7ry3tJI6g5AZi4JJSy/6O2ouH0=; b=OKQXmrAzWVDrWIylyNq6n8f+1m6MrGK/x7hzjZc9konS1D9XL+gGzp24kCxaVKmQm7 6dUPnsXwB26P6Jvr6Dxs8iK820ZJAFfUXTMRwyCxHZLuLIoB8+uumE1Yu8EOD0OcWJT5 eqcid83QK5gCs1KzaCBKs6BsTi6eGj07ym4UxEdo/Zr3+a+z/1meIPQ85WiBn3QlZoGl YgIX6H7nz/aH0RYE0rrFCBRYDpekjp0rg8hZe5T0kSKrEu9nBKr8qY0SjFIOhHWLpiQO YOCeZOCJwbtJ975X/2TqDW0LP/vqixNNAYM07oySXrd7OwpFAIJ3IWWrciNgIRjcjbKN eItw== X-Gm-Message-State: AOAM530SiMC9uHneT+99mDGYY8PVug7igU+ryvsg9yJ55J8YLMtwzlM6 xIdMY5vWmIGgx+OEn6UqIK69g46zAf3TRODnqTQ= X-Received: by 2002:ab0:3cac:: with SMTP id a44mr3058330uax.129.1634678256169; Tue, 19 Oct 2021 14:17:36 -0700 (PDT) MIME-Version: 1.0 References: <20211013190035.1876237-1-mmandlik@google.com> <20211013115927.BlueZ.v3.3.I68039747acc3c63f758278452889d6ed2bfff065@changeid> In-Reply-To: <20211013115927.BlueZ.v3.3.I68039747acc3c63f758278452889d6ed2bfff065@changeid> From: Luiz Augusto von Dentz Date: Tue, 19 Oct 2021 14:17:25 -0700 Message-ID: Subject: Re: [BlueZ PATCH v3 3/3] adv_monitor: Receive the Device Lost event To: Manish Mandlik Cc: Marcel Holtmann , ChromeOS Bluetooth Upstreaming , "linux-bluetooth@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Manish, On Wed, Oct 13, 2021 at 12:00 PM Manish Mandlik wrote: > > This patch registers a callback function to receive Advertisement > Monitor Device Lost 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. > > --- > > Changes in v3: > - Fix indentation of the adv_monitor_device_lost_callback() name and > it's arguments. > > Changes in v2: > - Update function name adv_monitor_tracking_callback() to > adv_monitor_device_lost_callback() as it will receive only Device Lost > event. > > src/adv_monitor.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/src/adv_monitor.c b/src/adv_monitor.c > index 715ac5904..385ab26e6 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_device_lost_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_device_lost *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 Device Lost event"); > + return; > + } > + > + ba2str(&ev->addr.bdaddr, addr); > + DBG("Adv monitor with handle 0x%04x stopped tracking the device %s", > + handle, addr); Isn't there a DeviceLost in the AdvertisementMonitor1 interface? Otherwise this is quite pointless since the only thing it is doing is printing the event without taking any action. > +} > + > /* 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_DEVICE_LOST, > + manager->adapter_id, adv_monitor_device_lost_callback, > + manager, NULL); > + > return manager; > } > > -- > 2.33.0.882.g93a45727a2-goog > -- Luiz Augusto von Dentz