Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2188413ybb; Mon, 30 Mar 2020 01:05:26 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtTLKWBBfg7O0lL8CaSL7a55J/Cu4C1ZybAC7WQHD5S7U7m8sFjuYrqCYVFizVbe1ufNBqC X-Received: by 2002:a4a:2fd0:: with SMTP id p199mr8623297oop.14.1585555526475; Mon, 30 Mar 2020 01:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585555526; cv=none; d=google.com; s=arc-20160816; b=AvffB7FUehVMtCDl6BYzEkL0GN7KHDVhmAl0g0aS2qKJVHQx86yGQEDtk7PL48ZEI1 CI1gt4zkPq4LCowemG+EqduxOWAQf6At1Fqe8FL9HUEfG8dqv/iI8tMZ1pNAnB2tGHxv 6Mr7C34mco3YSh3IurI/CIiTiubapPn8mdq/hIIbLwQcvb9yfhVJZSJ9oYMwEiW0obnH YapiajMcYU39n8EjNw27HpcxH6xs0/4scxOHv0jAeHfaam+7Z0P/wUM5ReBfuRFOQIBs SSUCU8irnQMfutybtCC6rgXs0hNdHSXzNTn6zs/xXdDCAIUbfOv0dIXoMMNlgZ8VFLV0 Tigw== 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:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=DK0WI8AjNOdJ0HpShf0kaJsDhms0l6HDXBAdYLD2yWg=; b=jxJOiW0QMnGmhmO6VDQMUbqPSr2CKmD9eMSs3twb5oW+t+oz6G/nsH9mIIx4KO9Gwp Uo+rnoQg3Bp7K9aIz2/0w5fMmQSKoWTe4LJM3sgtgqrpOaGy80An3JgANs1PDpABKuij CRvkAdhpmgFr2QB6Do8Vrzudy55qfRKcl0y0WfoLxL3waq61ktW5KWhkCXEuE9tDX8tT uTBab/Y1O7oH31sbyeM4LCINRi6hD5ooTK5xPVy/ZVSWzAT5dGlLyx/KoZeC/U7GVRXB CBOaFn9clRtru001PnSYF6dyeHQpQDBE3jZp3x7Ah2PosS6KHIDBIAkJUHWlKda6KH/4 GZcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="fFIbd/iQ"; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id l7si5907199otj.49.2020.03.30.01.05.14; Mon, 30 Mar 2020 01:05:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="fFIbd/iQ"; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 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 S1729604AbgC3IE2 (ORCPT + 99 others); Mon, 30 Mar 2020 04:04:28 -0400 Received: from mail-pf1-f202.google.com ([209.85.210.202]:37704 "EHLO mail-pf1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729586AbgC3IE2 (ORCPT ); Mon, 30 Mar 2020 04:04:28 -0400 Received: by mail-pf1-f202.google.com with SMTP id n28so14731646pfq.4 for ; Mon, 30 Mar 2020 01:04:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=DK0WI8AjNOdJ0HpShf0kaJsDhms0l6HDXBAdYLD2yWg=; b=fFIbd/iQfmusNX5pncc1J3JWwI9WNrQZY6XwVEx/F2N7GTGG3T3xchIUQU9+p43jaY ZWtIOwxvLKDcbAwsFExbFD9W4tIz1dQn1pIceXnJ1cqH9ivo5uO/cTT2j0l4XAaETpGV imBijkNXLc4M60Fy94ORltp/dmtT/4huBN5HwKGEOEVvyumhqBLtpWIbH0pEbutICHgb l9WKxNCkt7BI6LJhisz/IcwLuEh4Cse9tBOCeE+8lxH+UPyEx9Tcqhh7JX5aP8HIKAoK MAtp9adLsJpDYWrob1jSQYI6cg10VTJrZZDAzn/u6JGrucwqndNho+a2erkQ5vXz9vSx 8fiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=DK0WI8AjNOdJ0HpShf0kaJsDhms0l6HDXBAdYLD2yWg=; b=L+YIddl7Zb4frtVaRnDj8i5eQjpULU1slEEiVLb0AyL57jN6wu72Uy692JA5h5pxgy L3kT2z7GGY4jApZC30B0FHP5CVe6c8PWxzolo1VCF+6lj1MVlHkChk8mXOaTSXijg19p vMDcU0VgsnL0dGE6jCE41bXNW9a/ygolTTTGzDwFXI970MQ4pCciLEwzAPRa1SP7hKBB JkUeVIyN2gs6LaGe/qpzssEiyzusG8oVKH4eJWX/pn9vttorLWLkZ9e+3JugSKHcwaY4 WI2XoULcGY/eZWgnmorvZIb67KZza7L1Gi+K+Uu3Iyyio8TiTzqO0Cbpz+KDpI6LsdbE kpgw== X-Gm-Message-State: ANhLgQ1epwF8wv/qLo631ZnLf5dao2tm9ILlEY3szi0aVwQ6cqEO+yzy LK6cAz9lQTzPc8Gaz5pdVws7uECy6q+XohtOfJg/3H3222Go0LxEtVejUqU4y5Yr4cGs4DF4geN G0fi2UtrpdIpHU4HN5sVG/koRlq98TlJJEawAe4058clwja6EVR3gzMf7cnyzHPVYHRMy1ZAEZC as0NrZ31oIx9U= X-Received: by 2002:a17:90b:1985:: with SMTP id mv5mr14650899pjb.69.1585555464803; Mon, 30 Mar 2020 01:04:24 -0700 (PDT) Date: Mon, 30 Mar 2020 16:03:55 +0800 In-Reply-To: <20200330080357.96989-1-howardchung@google.com> Message-Id: <20200330160343.Bluez.v2.4.I0a98775e764e9f8dba1652853b6e7ba440f4c75b@changeid> Mime-Version: 1.0 References: <20200330080357.96989-1-howardchung@google.com> X-Mailer: git-send-email 2.26.0.rc2.310.g2932bb562d-goog Subject: [Bluez PATCH v2 4/6] monitor: Add support for decoding LE Set Advertising Interval From: Howard Chung To: linux-bluetooth@vger.kernel.org, luiz.von.dentz@intel.com Cc: chromeos-bluetooth-upstreaming@chromium.org, Howard Chung 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 The following lines will show in btmon: bluetoothd: Set Advertising Intervals: 0x0140, 0x0280 @ MGMT Command: LE Set Advertising Interval (0x0060) plen 4 Min advertising interval: 0x0140 Max advertising interval: 0x0280 @ MGMT Event: Command Complete (0x0001) plen 7 LE Set Advertising Interval (0x0060) plen 4 Status: Success (0x00) Current settings: 0x00040ad0 Signed-off-by: Howard Chung --- Changes in v2: None monitor/control.c | 2 +- monitor/packet.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/monitor/control.c b/monitor/control.c index 6dfefd05f..75457029e 100644 --- a/monitor/control.c +++ b/monitor/control.c @@ -200,7 +200,7 @@ static const char *settings_str[] = { "powered", "connectable", "fast-connectable", "discoverable", "bondable", "link-security", "ssp", "br/edr", "hs", "le", "advertising", "secure-conn", "debug-keys", "privacy", - "configuration", "static-addr", "phy", "wbs" + "configuration", "static-addr", "phy", "wbs" "advertising-intervals", }; static void mgmt_new_settings(uint16_t len, const void *buf) diff --git a/monitor/packet.c b/monitor/packet.c index 3d32563e6..00825cbb4 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -11669,6 +11669,7 @@ static const struct bitfield_data mgmt_settings_table[] = { { 15, "Static Address" }, { 16, "PHY Configuration" }, { 17, "Wideband Speech" }, + { 18, "Advertising Intervals" }, { } }; @@ -12988,6 +12989,23 @@ static void mgmt_set_phy_cmd(const void *data, uint16_t size) mgmt_print_phys("Selected PHYs", selected_phys); } +static void mgmt_set_adv_interval_cmd(const void *data, uint16_t size) +{ + uint16_t min_adv_interval = get_le16(data); + uint16_t max_adv_interval = get_le16(data+2); + + print_field("Min advertising interval: 0x%4.4x", min_adv_interval); + print_field("Max advertising interval: 0x%4.4x", max_adv_interval); +} + +static void mgmt_set_adv_interval_rsp(const void *data, uint16_t size) +{ + uint32_t current_settings = get_le32(data); + + print_field("Current settings: 0x%8.8x", current_settings); +} + + struct mgmt_data { uint16_t opcode; const char *str; @@ -13207,6 +13225,9 @@ static const struct mgmt_data mgmt_command_table[] = { { 0x0045, "Set PHY Configuration", mgmt_set_phy_cmd, 4, true, mgmt_null_rsp, 0, true }, + { 0x0060, "LE Set Advertising Interval", + mgmt_set_adv_interval_cmd, 4, true, + mgmt_set_adv_interval_rsp, 4, true}, { } }; -- 2.26.0.rc2.310.g2932bb562d-goog