Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1925146rwb; Fri, 28 Jul 2023 18:17:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlHlFXhd70wCzhjFbkN7DgohWWYPQ8fME0d2BsJu+76zGzyegkJcaVA4fnFCKmSnXrNsWnwf X-Received: by 2002:a17:902:c10c:b0:1b9:ce10:b50a with SMTP id 12-20020a170902c10c00b001b9ce10b50amr2868552pli.4.1690593472510; Fri, 28 Jul 2023 18:17:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690593472; cv=none; d=google.com; s=arc-20160816; b=i5yxhLJmjBwAVEK2mX3zhr3GxAtUHxOcYdRwWOvoMay9rgRzzbErf9Llv8gckluy9S 0h1EaSDlVM2CD2G5jr0trJz8cmV3bmkz90uXod9W4p0traVHG02MXYKWAGM/I1Kzgfcp vwF/vCWuonYZadYPlfvXcp6ZLi9aiKiEku1/8JlkOuEe4Ly3KOxucUwh8PSoQxKafywl 36FSPDw8Ja5HuMqaRGwNUYRZv/Ubp6+KgH39684hJWaVJ14DL9BRgXELByJeg2+8kBs3 eVwpCvcnb1xo+v+90RZYj8cF/s5sleP9tmbWPe3MfrpLgFMLAWoHYvR3ZDu9nPtberc6 SzaQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hQlKp1Eyp4oMP7RB5G+5J8r+sDCSBfQGnxxo3skLiWY=; fh=ayi0mI4Eq7RT4bHEcylKdHcK2YWMzm4C42w+lPSYHTc=; b=06YK9cv4EBUjruIbyrzzGiaBlmVWMYxRicTpCCUF/AV/M+cDfVPqBAfUwvEPE1SnvL pDYwiL8cDv6XxmW+hyODHskaemzOxhRI5r4uBJvqgXMCj4ROX2Cx7l/RL5WLNWBIeUBh HlyslkATsLNFrqbksvAG9Oig89OPuLLM1hmfl8UlqiZz9mSM4OrE6N9C9bza6lp9jSc0 yh8foysKpCnv8p/oQYlP2wzy3Udm00EFiUP9RLZdtnp89Y5tTbdhq6Hyi6aIJwel6H+h nqOgWu9eBxhdoNoxWEQ9OhUEcuf06g9e4RaERqR+8I8Gq89rfzJMkncx9kxO5A9QIUcG VlTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codecoup-pl.20221208.gappssmtp.com header.s=20221208 header.b=Tf9StyjF; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b8-20020a170902d50800b001b3cf7eb499si3989207plg.633.2023.07.28.18.17.39; Fri, 28 Jul 2023 18:17:52 -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=@codecoup-pl.20221208.gappssmtp.com header.s=20221208 header.b=Tf9StyjF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229782AbjG2Arb (ORCPT + 99 others); Fri, 28 Jul 2023 20:47:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235375AbjG2Ara (ORCPT ); Fri, 28 Jul 2023 20:47:30 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8C2744B1 for ; Fri, 28 Jul 2023 17:46:56 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-4fb7373dd35so4865726e87.1 for ; Fri, 28 Jul 2023 17:46:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codecoup-pl.20221208.gappssmtp.com; s=20221208; t=1690591557; x=1691196357; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hQlKp1Eyp4oMP7RB5G+5J8r+sDCSBfQGnxxo3skLiWY=; b=Tf9StyjFhujGM5FdsYgysQgsH7vB6B3fUqpcyZ6Ao47+wHAX1vFdgfdwGJzuNYUDvM ieCw5uOaAKZ0/dnrx5wQtVOVSjEE+FjWJaB7K2OhuEHStMcEpRb1IV4EZ0JSm8kkvbcJ wI+KwWCqwLWcp5VIdUUFKtrdqUEbALC6+q05aVkqjVOPeeTrS+3oTKN/mWFKs6MUGG+M 9UgyxWaQ69PCbGFpa9GdThuun9lNQRQdeuwFvxZLa2nlAH8UAxF54yiDhIJtOisIfRiQ 3dy0m32Sey8ELBqNiK0woGNhNc06L/LeWyQOA1INWGnfF75ihms+oJnG2tHnUodNXNvM tSXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690591557; x=1691196357; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hQlKp1Eyp4oMP7RB5G+5J8r+sDCSBfQGnxxo3skLiWY=; b=VEJW+/JwDlUKtfWAGmaYsLx0pCT7Ohvqi/CWQVh7kcY8jyr84Ft/a/uc6wnuoWxSiw 4qQuC9B9fWTmFUHQD1HAMP3R4TtgiGFs+y57t/Ms5935KcESlgS+sbFi6AI/Mn3lm768 CjiI+cpG46YmdZqHvp71ObMddQf7iafqROv7ABBWrWU+BHuzfpuZVx5KlR+hs+0hJW/e KbGQvrfjte2cRmVlfstRSPWz/v69/6L9HZTqeZZGo5T9WdvLzEaVftYc+gklA8K3sD6a uhya23KjHAcoWuWhuoQJg6R+nL3ZuceKRy0bdPFaKxFOsyGNiaWm537GlKaxJHJpE9zF d+fg== X-Gm-Message-State: ABy/qLYtVVLobQtOGyU71sfsuKnD1i3WX1UEJg6+CrJXZOHw/8k17unU QAQIRrNLTdgoytIS7jkyGfrZgA4tBPOhoOOXvCM= X-Received: by 2002:ac2:5598:0:b0:4f8:6253:540 with SMTP id v24-20020ac25598000000b004f862530540mr1328000lfg.19.1690591556971; Fri, 28 Jul 2023 17:45:56 -0700 (PDT) Received: from rymek.localdomain (217.96.255.138.ipv4.supernova.orange.pl. [217.96.255.138]) by smtp.gmail.com with ESMTPSA id r25-20020ac24d19000000b004fe1f1c0ee4sm617746lfi.82.2023.07.28.17.45.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jul 2023 17:45:56 -0700 (PDT) From: =?UTF-8?q?=C5=81ukasz=20Rymanowski?= To: linux-bluetooth@vger.kernel.org Cc: Szymon Czapracki Subject: [PATCH BlueZ 3/5] monitor/ll: Add support for connection parameter command. Date: Sat, 29 Jul 2023 02:45:50 +0200 Message-Id: <20230729004552.1422547-4-lukasz.rymanowski@codecoup.pl> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230729004552.1422547-1-lukasz.rymanowski@codecoup.pl> References: <20230729004552.1422547-1-lukasz.rymanowski@codecoup.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 From: Szymon Czapracki LL_CONNECTION_PARAM_REQ (0x0f) Interval min: 7.50 msec (0x0006) Interval max: 7.50 msec (0x0006) Latency: 0 (0x0000) Timeout: 5000 msec (0x01f4) Preffered periodicity: 0.00 (0x00) Reference connection event count: 4 (0x04) Offset 0: 0.00 msec (0x00) Offset 1: 0.00 msec (0x00) Offset 2: 1.25 msec (0x01) Offset 3: 0.00 msec (0x00) Offset 4: 2.50 msec (0x02) Offset 5: 0.00 msec (0x00) LL_CONNECTION_PARAM_RSP (0x10) Interval min: 7.50 msec (0x0006) Interval max: 7.50 msec (0x0006) Latency: 0 (0x0000) Timeout: 5000 msec (0x01f4) Preffered periodicity: 0.00 (0x00) Reference connection event count: 4 (0x04) Offset 0: 318.75 msec (0xff) Offset 1: 318.75 msec (0xff) Offset 2: 318.75 msec (0xff) Offset 3: 318.75 msec (0xff) Offset 4: 318.75 msec (0xff) Offset 5: 318.75 msec (0xff) --- monitor/bt.h | 28 ++++++++++++++++++++++++ monitor/ll.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 88 insertions(+), 2 deletions(-) diff --git a/monitor/bt.h b/monitor/bt.h index fcc5478bf..4482e6e2c 100644 --- a/monitor/bt.h +++ b/monitor/bt.h @@ -95,8 +95,36 @@ struct bt_ll_peripheral_feature_req { } __attribute__ ((packed)); #define BT_LL_CONN_PARAM_REQ 0x0f +struct bt_ll_conn_param_req { + uint16_t interval_min; + uint16_t interval_max; + uint16_t latency; + uint16_t timeout; + uint8_t pref_period; + uint16_t pref_conn_evt_count; + uint8_t offset_0; + uint8_t offset_1; + uint8_t offset_2; + uint8_t offset_3; + uint8_t offset_4; + uint8_t offset_5; +} __attribute__ ((packed)); #define BT_LL_CONN_PARAM_RSP 0x10 +struct bt_ll_conn_param_rsp { + uint16_t interval_min; + uint16_t interval_max; + uint16_t latency; + uint16_t timeout; + uint8_t pref_period; + uint16_t pref_conn_evt_count; + uint8_t offset_0; + uint8_t offset_1; + uint8_t offset_2; + uint8_t offset_3; + uint8_t offset_4; + uint8_t offset_5; +} __attribute__ ((packed)); #define BT_LL_REJECT_IND_EXT 0x11 struct bt_ll_reject_ind_ext { diff --git a/monitor/ll.c b/monitor/ll.c index f588d5e99..feeb13e92 100644 --- a/monitor/ll.c +++ b/monitor/ll.c @@ -458,6 +458,64 @@ static void peripheral_feature_req(const void *data, uint8_t size) packet_print_features_ll(pdu->features); } +static void conn_param_req(const void *data, uint8_t size) +{ + const struct bt_ll_conn_param_req *pdu = data; + + print_field("Interval min: %.2f msec (0x%4.4x)", + pdu->interval_min * 1.25, pdu->interval_min); + print_field("Interval max: %.2f msec (0x%4.4x)", + pdu->interval_max * 1.25, pdu->interval_max); + print_field("Latency: %d (0x%4.4x)", pdu->latency, pdu->latency); + print_field("Timeout: %d msec (0x%4.4x)", pdu->timeout * 10, + pdu->timeout); + print_field("Preffered periodicity: %.2f (0x%2.2x)", + pdu->pref_period * 1.25, pdu->pref_period); + print_field("Reference connection event count: %d (0x%2.2x)", + pdu->pref_conn_evt_count, pdu->pref_conn_evt_count); + print_field("Offset 0: %.2f msec (0x%2.2x)", pdu->offset_0 * 1.25, + pdu->offset_0); + print_field("Offset 1: %.2f msec (0x%2.2x)", pdu->offset_1 * 1.25, + pdu->offset_1); + print_field("Offset 2: %.2f msec (0x%2.2x)", pdu->offset_2 * 1.25, + pdu->offset_2); + print_field("Offset 3: %.2f msec (0x%2.2x)", pdu->offset_3 * 1.25, + pdu->offset_3); + print_field("Offset 4: %.2f msec (0x%2.2x)", pdu->offset_4 * 1.25, + pdu->offset_4); + print_field("Offset 5: %.2f msec (0x%2.2x)", pdu->offset_5 * 1.25, + pdu->offset_5); +} + +static void conn_param_rsp(const void *data, uint8_t size) +{ + const struct bt_ll_conn_param_rsp *pdu = data; + + print_field("Interval min: %.2f msec (0x%4.4x)", + pdu->interval_min * 1.25, pdu->interval_min); + print_field("Interval max: %.2f msec (0x%4.4x)", + pdu->interval_max * 1.25, pdu->interval_max); + print_field("Latency: %d (0x%4.4x)", pdu->latency, pdu->latency); + print_field("Timeout: %d msec (0x%4.4x)", pdu->timeout * 10, + pdu->timeout); + print_field("Preffered periodicity: %.2f (0x%2.2x)", + pdu->pref_period * 1.25, pdu->pref_period); + print_field("Reference connection event count: %d (0x%2.2x)", + pdu->pref_conn_evt_count, pdu->pref_conn_evt_count); + print_field("Offset 0: %.2f msec (0x%2.2x)", pdu->offset_0 * 1.25, + pdu->offset_0); + print_field("Offset 1: %.2f msec (0x%2.2x)", pdu->offset_1 * 1.25, + pdu->offset_1); + print_field("Offset 2: %.2f msec (0x%2.2x)", pdu->offset_2 * 1.25, + pdu->offset_2); + print_field("Offset 3: %.2f msec (0x%2.2x)", pdu->offset_3 * 1.25, + pdu->offset_3); + print_field("Offset 4: %.2f msec (0x%2.2x)", pdu->offset_4 * 1.25, + pdu->offset_4); + print_field("Offset 5: %.2f msec (0x%2.2x)", pdu->offset_5 * 1.25, + pdu->offset_5); +} + static void reject_ind_ext(const void *data, uint8_t size) { const struct bt_ll_reject_ind_ext *pdu = data; @@ -707,8 +765,8 @@ static const struct llcp_data llcp_table[] = { { 0x0c, "LL_VERSION_IND", version_ind, 5, true }, { 0x0d, "LL_REJECT_IND", reject_ind, 1, true }, { 0x0e, "LL_PERIPHERAL_FEATURE_REQ", peripheral_feature_req, 8, true }, - { 0x0f, "LL_CONNECTION_PARAM_REQ", NULL, 23, true }, - { 0x10, "LL_CONNECTION_PARAM_RSP", NULL, 23, true }, + { 0x0f, "LL_CONNECTION_PARAM_REQ", conn_param_req, 23, true }, + { 0x10, "LL_CONNECTION_PARAM_RSP", conn_param_rsp, 23, true }, { 0x11, "LL_REJECT_IND_EXT", reject_ind_ext, 2, true }, { 0x12, "LL_PING_REQ", null_pdu, 0, true }, { 0x13, "LL_PING_RSP", null_pdu, 0, true }, -- 2.34.1