From patchwork Tue Apr 5 00:42:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 558348 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27DD0C433EF for ; Tue, 5 Apr 2022 02:23:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229700AbiDECZA (ORCPT ); Mon, 4 Apr 2022 22:25:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229665AbiDECY7 (ORCPT ); Mon, 4 Apr 2022 22:24:59 -0400 Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 107311DB8B2 for ; Mon, 4 Apr 2022 18:19:47 -0700 (PDT) Received: by mail-qt1-x833.google.com with SMTP id z19so9322945qtw.2 for ; Mon, 04 Apr 2022 18:19:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=BK/L2Cu+9Ne/PHhGz9BJEq/JD01g/TerpoLSZnxVAGM=; b=qlHIefOcqZuA5wLGg5B7TaCgmFhcAsNRL8AWK+wBu9DtlHZYdEhd3Hg/UM2+z1fLAp RvQnA90zR8zZGiVD2ycFr6Jr+wIKvzv0fEaWm0E0UlM1L0USbXb2IaRfdhGGFKnEfeVC JHDgKbIO9z0p2RG0KOG2TdC2YSrIkV6T76w84AQBo985hEmWABxnGRirscarHJKV4UND BRccCjGYYeISE2d2/5zNtKHLoKh+teEgUXtCirpfyJTq6n4e4Wvq8wYN75IbOhMbnfUT emnEhvcE54O/N7fDHk1YJJ89b51HWbadDJ8/Qvj9CvcTJ3mird5t/B2n6BA8UzvysWC2 S18A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=BK/L2Cu+9Ne/PHhGz9BJEq/JD01g/TerpoLSZnxVAGM=; b=GIXMn6Yat2BS6x9c2FoKkFKvYU4bJq9PaYl7ESdrY1jtD/Q8PrHQMLqyCl4J04CeGP doS+Oer0cjVnBaWGa8RB9RIs9nVe+/EUoRhGJ/MLytL+5XMIcF3+0035lwOH+jyNDbFO N92PvvaTOBaq8qLCWW7aR5b7BcBZBRaYyNuTvUMnQG9nsDLtQawAItFPD4p9iYUY2BU/ KKW9XPYfAYXYm00AnU4ZZXzkgYVw5NKf+QaBVWxd0vTW7rPlY9JoJQKauhIxuCn+JImE Z+fOhUSymJluSSh44dhysbvki+lVUf5LTbq7BTmG+obL+V7I2I2HZ6GAX0KUft9WWVBd dWrQ== X-Gm-Message-State: AOAM530EnB5havD70SxO567CJ7JXrToLZzMR/vh8PUenslad6UfHKQHM wpA1N4ibl+odgEBEv0JkMka3zYpR4CY= X-Google-Smtp-Source: ABdhPJwllxrRRwNLWMCca/+IP+2MgsjujBO8dxh93iJD7Uqit963EPqolbRJ6xrggu5mKrIcOhrkbA== X-Received: by 2002:a05:6638:d0b:b0:321:6296:340d with SMTP id q11-20020a0566380d0b00b003216296340dmr585922jaj.3.1649119335072; Mon, 04 Apr 2022 17:42:15 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id v9-20020a92c809000000b002ca351aa12fsm3266020iln.70.2022.04.04.17.42.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 17:42:14 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 1/2] monitor: Add support for LE BIG Info Adverting Report Date: Mon, 4 Apr 2022 17:42:12 -0700 Message-Id: <20220405004213.1164595-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This adds support for LE BIG Info Advertising Report. --- monitor/bt.h | 17 +++++++++++++++++ monitor/packet.c | 23 +++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/monitor/bt.h b/monitor/bt.h index 704c70fba..e9f72de36 100644 --- a/monitor/bt.h +++ b/monitor/bt.h @@ -3653,6 +3653,23 @@ struct bt_hci_evt_le_req_peer_sca_complete { uint8_t sca; } __attribute__ ((packed)); +#define BT_HCI_EVT_LE_BIG_INFO_ADV_REPORT 0x22 +struct bt_hci_evt_le_big_info_adv_report { + uint16_t sync_handle; + uint8_t num_bis; + uint8_t nse; + uint16_t iso_interval; + uint8_t bn; + uint8_t pto; + uint8_t irc; + uint16_t max_pdu; + uint8_t sdu_interval[3]; + uint16_t max_sdu; + uint8_t phy; + uint8_t framing; + uint8_t encryption; +} __attribute__ ((packed)); + #define BT_HCI_ERR_SUCCESS 0x00 #define BT_HCI_ERR_UNKNOWN_COMMAND 0x01 #define BT_HCI_ERR_UNKNOWN_CONN_ID 0x02 diff --git a/monitor/packet.c b/monitor/packet.c index 1f04063d3..6ef2fba3b 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -10887,6 +10887,25 @@ static void le_req_sca_complete_evt(const void *data, uint8_t size) print_sca(evt->sca); } +static void le_big_info_evt(const void *data, uint8_t size) +{ + const struct bt_hci_evt_le_big_info_adv_report *evt = data; + + print_field("Sync Handle: 0x%4.4x", evt->sync_handle); + print_field("Number BIS: %u", evt->num_bis); + print_field("NSE: %u", evt->nse); + print_slot_125("ISO Interval", evt->iso_interval); + print_field("BN: %u", evt->bn); + print_field("PTO: %u", evt->bn); + print_field("IRC: %u", evt->irc); + print_field("Maximum PDU: %u", evt->max_pdu); + print_usec_interval("SDU Interval", evt->sdu_interval); + print_field("Maximum SDU: %u", evt->max_sdu); + print_le_phy("PHY", evt->phy); + print_framing(evt->framing); + print_field("Encryption: 0x%02x", evt->encryption); +} + struct subevent_data { uint8_t subevent; const char *str; @@ -11005,6 +11024,10 @@ static const struct subevent_data le_meta_event_table[] = { le_req_sca_complete_evt, sizeof( struct bt_hci_evt_le_req_peer_sca_complete)}, + { BT_HCI_EVT_LE_BIG_INFO_ADV_REPORT, + "LE Broadcast Isochronous Group Info Advertising Report", + le_big_info_evt, + sizeof(struct bt_hci_evt_le_big_info_adv_report) }, { } }; From patchwork Tue Apr 5 00:42:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 556316 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95AEBC433F5 for ; Tue, 5 Apr 2022 02:00:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229590AbiDECCJ (ORCPT ); Mon, 4 Apr 2022 22:02:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbiDECCH (ORCPT ); Mon, 4 Apr 2022 22:02:07 -0400 Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89FB245EF99 for ; Mon, 4 Apr 2022 18:19:06 -0700 (PDT) Received: by mail-qt1-x833.google.com with SMTP id a11so9258157qtb.12 for ; Mon, 04 Apr 2022 18:19:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=NUrAkQGQKdkGdKx4fXOK8rdMdpWvdngYYC4kgGVLqhE=; b=J+Wufke3aVHX3YAVcnwLqnyWJBNQ7pWVQd3/V93PrvVOnligj0JQsdX9aHUNaUpzP+ v04bkGO9iwLritGAbm333bLmKeSYY9S0vhnGNZCV/r7oyvA9B9djrkTBcVMSQWG4iZcf j8uGqmPmXfhoH3apvWvFJO8VUYlqVqt7fYQKGq8QP4DqDs0f0KdKTBFrj4Hbl90tjZpG 3zhVRec/wopdNOma/NTQv9j7gkx2AkZLWu3LfFdLo+NJziwwFdQ3ueRsR6+bpEy1xIeT nVPkDRKhG2VP/hp5icEd8+EgFL3pLzFSdsexxr2NC6fmmbNwrAaJmbxFN3kkTmIJx5CE J8Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NUrAkQGQKdkGdKx4fXOK8rdMdpWvdngYYC4kgGVLqhE=; b=zRfMM7/ZKcf1AxCPvnIuRnXUr38kqf2ATkDf0Kqvwpl9SjRxuRIDZ56DUMzijaFRwK KA2u9PeBQcZoAxhjVkxByG4LdnkZyJe7DVoIHNOy7aIucEkgeMN/2N9BzyBMNxXY5Glv nX54YNTL70Z77MqGqUwsCDlxSdGu4JGYLPqrlQSVUJ1GmO4bcvTIPw/bkWuRcq6rUjFV AT1WFFhOSKggw7Wsrib5uJ/dzDL0BD/NUTghewVsbGhmVKrstz7+bmGb3fSI0T5/TNVC sAgoNkNYSi0Zfe6JaWxbMcITOydYrbQySi9T9EJySPqawtIxKn/LYk5erF4Sz+XxjaGB 6G7A== X-Gm-Message-State: AOAM5330j3GWGzvanHbsVUuIjGHo+mP6cTy9VDAIjiJpsUF4dt0iHJGk +bi9YDaRVCSDs1UoYE59QlYkjJASqok= X-Google-Smtp-Source: ABdhPJzy1dNTI3Shj9CpiKbzdL/D6Z298EFxZsQi0IcrlCO/8CALC4LyqMey5vyCEuny+RHQSLGe/A== X-Received: by 2002:a05:6638:4122:b0:323:d3db:2bdc with SMTP id ay34-20020a056638412200b00323d3db2bdcmr556326jab.121.1649119335717; Mon, 04 Apr 2022 17:42:15 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id v9-20020a92c809000000b002ca351aa12fsm3266020iln.70.2022.04.04.17.42.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 17:42:15 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 2/2] btdev: Add support for sending LE BIG Info Adv Reports Date: Mon, 4 Apr 2022 17:42:13 -0700 Message-Id: <20220405004213.1164595-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405004213.1164595-1-luiz.dentz@gmail.com> References: <20220405004213.1164595-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This adds support for sending LE BIG Info Adv Reports if LE Create BIG has been called. --- emulator/btdev.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/emulator/btdev.c b/emulator/btdev.c index 9dc7b1e90..2ee39ab0b 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -1139,7 +1139,8 @@ static struct btdev_conn *conn_add_bis(struct btdev *dev, uint16_t handle, return conn; } -static struct btdev_conn *find_bis_index(struct btdev *remote, uint8_t index) +static struct btdev_conn *find_bis_index(const struct btdev *remote, + uint8_t index) { struct btdev_conn *conn; const struct queue_entry *entry; @@ -5105,6 +5106,40 @@ static int cmd_set_pa_data(struct btdev *dev, const void *data, return 0; } +static void send_biginfo(struct btdev *dev, const struct btdev *remote) +{ + struct bt_hci_evt_le_big_info_adv_report ev; + const struct btdev_conn *conn; + struct bt_hci_bis *bis; + + conn = find_bis_index(remote, 0); + if (!conn) + return; + + bis = conn->data; + + memset(&ev, 0, sizeof(ev)); + ev.sync_handle = cpu_to_le16(dev->le_pa_sync_handle); + ev.num_bis = 1; + + while (find_bis_index(remote, ev.num_bis)) + ev.num_bis++; + + ev.nse = 0x01; + ev.iso_interval = bis->latency; + ev.bn = 0x01; + ev.pto = 0x00; + ev.irc = 0x01; + ev.max_pdu = bis->sdu; + memcpy(ev.sdu_interval, bis->sdu_interval, sizeof(ev.sdu_interval)); + ev.max_sdu = bis->sdu; + ev.phy = bis->phy; + ev.framing = bis->framing; + ev.encryption = bis->encryption; + + le_meta_event(dev, BT_HCI_EVT_LE_BIG_INFO_ADV_REPORT, &ev, sizeof(ev)); +} + static void send_pa(struct btdev *dev, const struct btdev *remote, uint8_t offset) { @@ -5135,7 +5170,10 @@ static void send_pa(struct btdev *dev, const struct btdev *remote, if (pdu.ev.data_status == 0x01) { offset += pdu.ev.data_len; send_pa(dev, remote, offset); + return; } + + send_biginfo(dev, remote); } static void le_pa_sync_estabilished(struct btdev *dev, struct btdev *remote,