Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1067875pxb; Wed, 13 Apr 2022 20:00:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXeBaJ75QdinbRVThSKg8qz3Z1CxHklQkFZQAa307zieV4gbL57i9Rd2VXzyZ1TWRSJtm9 X-Received: by 2002:a05:6402:448a:b0:41d:793d:8252 with SMTP id er10-20020a056402448a00b0041d793d8252mr714800edb.6.1649905220235; Wed, 13 Apr 2022 20:00:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649905220; cv=none; d=google.com; s=arc-20160816; b=xsy5SdDyKAlXirdpXH7S8JG8tXSHkrNlFSoQxIeH2FbAonDNWd44Itol4AFjOTefQx FzPVnJCee+fZqYQOrOgViLslBj3PheJ+cQg+abzGRCQDlK65aqQVWUPWlx5IsmosY9R4 DX0uZUU4qRplJCbB6ZNK8rOr3MZ7yy7k0D7oMVvmu36V8W57v6p26FYR2D5fN6hozb7T ai/rxQisJ/lFQXEQ2JhMCOxy+KWoL6Li0ENa3MDhDMmDBua50ZWSQB3L95IIWf44qX+I 556qwG1A3nmr0evxu8l4SrzqRDy1fcZ0TXUjSrvLgUT750WOQoQklINppIbiYTaDzr/3 1IWQ== 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=6LJF+h/akEcwhrcKGG2Skrxic+lav38EsF4kiYAdZbg=; b=QntvnO0wAlbtSjBu8NNi3vNjwsWfF9K0y8sCbooZ/yr5AXbC2MwrgdrIrBrD+dR5ba XQedPaiOx/yxguJ0HaiwSk2IqYvcr3sDOcG9dor8TDPg2Mki6eqDx72NH4QnTDfgAb/U UQa1lymeDSw48dkEkQDeVg5aNQVZZOKAQW2FMX6xuoV1fDl4W6srFhggSuOpxZbH8ZvR fKrg8vcrVjZ08E3VPNy+zmTFw5roIuhT8J52mhypM7/kffsp83SIG6uNQdFrfisO2Z3P 360EPmalXuzZCZd64vGFG09w7G5iQoyCCB2hBIuhaNDDXAHNoxem9qzW489HYyAwdPno nUSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ok9u4niO; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c6-20020a05640227c600b0041d6b63af8fsi2623684ede.163.2022.04.13.19.59.36; Wed, 13 Apr 2022 20:00:20 -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=@google.com header.s=20210112 header.b=ok9u4niO; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238261AbiDMU53 (ORCPT + 99 others); Wed, 13 Apr 2022 16:57:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237910AbiDMU52 (ORCPT ); Wed, 13 Apr 2022 16:57:28 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED9C86A42B for ; Wed, 13 Apr 2022 13:55:06 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-2d2d45c0df7so26831037b3.1 for ; Wed, 13 Apr 2022 13:55:06 -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=6LJF+h/akEcwhrcKGG2Skrxic+lav38EsF4kiYAdZbg=; b=ok9u4niOOz0V1a+9YkmZq9LN8Qyv2y9qKc3wKaM9JozM74VJmMbEmQsVNL8SYgRknV hHeJubzVNpf4J6PRnhAicP942B4HDdDTbiRECgwYTdpg612+77ZEwKGtSa4bKylSgu95 Z4bI7KSHqhM+eRu9atMYzQte0ok/XntETEmYOIL7ZlARd2NrCHNnI5J8Ev3nd7oXDzLM VObs3COCVYR3PYXTGvXCn4WLn/RYPzUABUXT4CKDb14QT0Qo3U/b3kVnQsVqFdLXFZxM TrTPaThCOETJt7vlQDUFR398A82ugaRCfwPK6TklAIuqWo9eT+l71dq3EO0JFvE6Hb+F OLqw== 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=6LJF+h/akEcwhrcKGG2Skrxic+lav38EsF4kiYAdZbg=; b=XVuVPy3Boh8mRBi9c19eE0DMRojqUT8iVPCAGQQjleIZBzN5g+r1L7MmaOdlLVEGTN i5efd+0ndQpBX7MxbAcOql0UnoYQQSG3jElxRsZOHqrrdP02tWly2tvlDuxPZnc9P/Ix VC0Eb5XKj8snNWoIRqUukuhgSSJkdGVOO9DllyPw4jVuVmNtZrsVSeDlWEBA6PeaYfvU /fLHW/sOvaK2OxPIx49bRgoCCvFUeXMBHaXZJyd4KxKX4Y8lewDd2HxNyw6PHsALajIs T9f+RiYqNATKpc6iFsdZLiUcf9L0CCmUEuFi+38Sz8tqGJWX58pCIdcDE+VUINow9oYr ClxA== X-Gm-Message-State: AOAM532YSNBJMbnCeTvAjLnaJoxqtD1qkqsvFAHJGOtxrzLBNauDqxNZ T/wgOBnXKGe9L38Ggpe0gmgEeXImxsSA5Q== X-Received: from mmandlik.mtv.corp.google.com ([2620:15c:202:201:2620:46aa:79ff:778d]) (user=mmandlik job=sendgmr) by 2002:a81:59d5:0:b0:2ef:4aa0:fdc1 with SMTP id n204-20020a8159d5000000b002ef4aa0fdc1mr661801ywb.113.1649883306144; Wed, 13 Apr 2022 13:55:06 -0700 (PDT) Date: Wed, 13 Apr 2022 13:54:45 -0700 In-Reply-To: <20220413135223.BlueZ.v2.1.I21d5ed25e9a0a2427bddbd6d4ec04d80d735fc53@changeid> Message-Id: <20220413135223.BlueZ.v2.5.I53ad1b66c8f8a65e5950354cd20417d812ad9c72@changeid> Mime-Version: 1.0 References: <20220413135223.BlueZ.v2.1.I21d5ed25e9a0a2427bddbd6d4ec04d80d735fc53@changeid> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog Subject: [BlueZ PATCH v2 5/9] monitor: Display AdvMonitor DeviceFound/Lost events From: Manish Mandlik To: marcel@holtmann.org, luiz.dentz@gmail.com Cc: chromeos-bluetooth-upstreaming@chromium.org, linux-bluetooth@vger.kernel.org, Manish Mandlik , Miao-chen Chou Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL 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 Display information about MGMT_EV_ADV_MONITOR_DEVICE_FOUND and MGMT_EV_ADV_MONITOR_DEVICE_LOST events in the btmon output. Reviewed-by: Miao-chen Chou --- (no changes since v1) monitor/packet.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/monitor/packet.c b/monitor/packet.c index b7431b57d..6f615f7ba 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -14103,6 +14103,31 @@ static void mgmt_device_found_evt(const void *data, uint16_t size) print_eir(data + 14, size - 14, false); } +static void mgmt_adv_monitor_device_found_evt(const void *data, uint16_t size) +{ + uint16_t handle = get_le16(data); + uint8_t address_type = get_u8(data + 8); + int8_t rssi = get_s8(data + 9); + uint32_t flags = get_le32(data + 10); + uint16_t data_len = get_le16(data + 14); + + print_field("Handle: %u", handle); + mgmt_print_address(data + 2, address_type); + print_rssi(rssi); + mgmt_print_device_flags(flags); + print_field("Data length: %u", data_len); + print_eir(data + 16, size - 16, false); +} + +static void mgmt_adv_monitor_device_lost_evt(const void *data, uint16_t size) +{ + uint16_t handle = get_le16(data); + uint8_t address_type = get_u8(data + 8); + + print_field("Handle: %u", handle); + mgmt_print_address(data + 2, address_type); +} + static void mgmt_discovering_evt(const void *data, uint16_t size) { uint8_t type = get_u8(data); @@ -14414,6 +14439,10 @@ static const struct mgmt_data mgmt_event_table[] = { mgmt_controller_suspend_evt, 1, true }, { 0x002e, "Controller Resumed", mgmt_controller_resume_evt, 8, true }, + { 0x002f, "Adv Monitor Device Found", + mgmt_adv_monitor_device_found_evt, 16, false }, + { 0x0030, "Adv Monitor Device Lost", + mgmt_adv_monitor_device_lost_evt, 9, true }, { } }; -- 2.36.0.rc0.470.gd361397f0d-goog