From patchwork Mon Aug 21 15:50:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudia Draghicescu X-Patchwork-Id: 13359589 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 CD2E5EE49A6 for ; Mon, 21 Aug 2023 15:51:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236341AbjHUPvl (ORCPT ); Mon, 21 Aug 2023 11:51:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236462AbjHUPvj (ORCPT ); Mon, 21 Aug 2023 11:51:39 -0400 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2064.outbound.protection.outlook.com [40.107.241.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32A41A1 for ; Mon, 21 Aug 2023 08:51:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MoDnvOmwms3OlSOzjYIJys3U7H/RhfiP06YaPlK02+WUlPy9yuscO5vRyQJz+KIWMyXP4nhwpUCBXF+f4jwNkZt8PKG5JubcHhQScH54Dopk9z995TeyUGel4jDkWi9DsoE3dXu0Bl+zCVE3D3pFjVRjfg4se4yXdwGmKJwxmwcWG0eWK2FbypU93BrBCj9mXwr1HadQYOxgfuMlNYEBCSeJFXsmTr2/zGRvj0JLgMaEzqoxb6PDVO0mOpPfeCfSwvXnNxlIvPhDI46LUjyxt/+slUpDyjlyLeCgr7q5uz/sG6WFZd4Fpa6aDQ+vkpEofj7C8B3o7Z4VypvC+Yb51g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vftM1PO1nVvxK/O/Aq+ZVl6bkDRzJoRm3SRkx2t2ZUI=; b=D/ObNAaRhCkgoMZWtOGDGhCCPM6LMFPcB9MVDzJaZGXlhsOlT5G/qpN1+SshjEQWeu/WP6JhUubWwhw6CnqNXpo50zfvIHHtbVQngtUET/3rsVOq6Fz5OQvcZIdIgJNkpnrt7cp33DusAbFJQNTCca9X3SnoTBicu4PDChg67CPlkdptA2DE3G0bXi69IpEEOhENgogKqESb51W9w0WiFj1ojv07lkKKKA444ISvvNsqGVeDZra6HQoD193//r3hg8xkTz/bs+jT3XNisjAzSJIytUvr8msQH2OQsrlWepgpsyEAPMt+SyLNYRAaH+iBi0k7Bur5A5C96OXyZaBPvg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vftM1PO1nVvxK/O/Aq+ZVl6bkDRzJoRm3SRkx2t2ZUI=; b=VwK9A5YanzEL9DP7zyRrYYjzTOE/YpJUlCx+p4tXYURLvr+/3pP0brMaYSw+bPCVdOox3eLitLsi7yaNGNl0vWSUr98KWOgydpfA8/1oAt4fTtvmTndWvhpiEuUEf/mjg+3C1N3gi7I40X7jmbSzZKe15IkHJD/9GhTnySmdWPM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9151.eurprd04.prod.outlook.com (2603:10a6:150:26::9) by GVXPR04MB9952.eurprd04.prod.outlook.com (2603:10a6:150:117::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20; Mon, 21 Aug 2023 15:51:32 +0000 Received: from GV1PR04MB9151.eurprd04.prod.outlook.com ([fe80::c2fe:9eef:61ea:36d9]) by GV1PR04MB9151.eurprd04.prod.outlook.com ([fe80::c2fe:9eef:61ea:36d9%7]) with mapi id 15.20.6699.020; Mon, 21 Aug 2023 15:51:32 +0000 From: Claudia Draghicescu To: linux-bluetooth@vger.kernel.org Cc: iulia.tanasescu@nxp.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, Claudia Draghicescu Subject: [PATCH BlueZ v7 1/6] shared/bap: Add support for BAP broadcast sink Date: Mon, 21 Aug 2023 18:50:59 +0300 Message-Id: <20230821155104.86954-2-claudia.rosu@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230821155104.86954-1-claudia.rosu@nxp.com> References: <20230821155104.86954-1-claudia.rosu@nxp.com> X-ClientProxiedBy: AM0PR04CA0127.eurprd04.prod.outlook.com (2603:10a6:208:55::32) To GV1PR04MB9151.eurprd04.prod.outlook.com (2603:10a6:150:26::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9151:EE_|GVXPR04MB9952:EE_ X-MS-Office365-Filtering-Correlation-Id: a2805cf0-6ca7-4903-b067-08dba25e7dc8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vvKoaR09BgHh5wKmAL1+YorlX9oHEEKZBI1dnnI0NotCngE44K+OLWRTryqNej2PB+6MQhnpq4zH1nK9ms8rSlG5VVx8vSxpL8ZbHec/TwE3m9IzfBJpygowstj/GdOXYS5tPf0ckI9lo8GKV8la5u7X1uLX4CAE768WmVNmGUH5FeMLJ0ybLVTsL5RM5uZoOubmorL6PpzANWSJoCI0+MDDMthbpvZExAMxPH5BPh7FvMb4PaP41NITFMT/qlKuDO3tkF1ewgqcCscGOlplhAfWj3drmzZx5u5/HZXwzuzE8wxPyE069QXDOcjr4tIxZ37MwW0iBDW3/8d5lcf7pk41lxJfIsC7gbMuHNxmxadq702Wy8CRvZ9bIQQyVO502U5QBSqMiJS7UeBhvT/MAcmVoMrEuWMNwgkhM0Gy5YLcG1Sm1827E8SZusoATopZ/EmhHJqCaf7nNT45c7CDI3j93As63g9hQIO4Qk0Os1gIx3w3SJcGDycmJCSGC6+IFMk5BgJdGINAmwFw8q/eimpw578lwqd1IpudQYSkO6C4VS/okOqIfwtN3J15fCjsy+1kls0rG1tkNxAPQy2jzI4V/FhJ9GSdSma4YHmNXTm09LfemeWmeZER/Xr/2hFQ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV1PR04MB9151.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(366004)(39860400002)(376002)(136003)(396003)(451199024)(186009)(1800799009)(2906002)(30864003)(52116002)(38350700002)(38100700002)(6506007)(6486002)(83380400001)(5660300002)(26005)(86362001)(8676002)(2616005)(8936002)(4326008)(316002)(66946007)(6512007)(6916009)(66556008)(66476007)(478600001)(6666004)(36756003)(41300700001)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: w5TubJyWs8ajKo1vuoFeMM5FNiFv0XpvbhRNjrPX9/lZTuIy53xWkbd+UKwHEllQIqQM7LYlyIv3KZI15ziJo9NEB9jJFECFEXlExExF8A3ynZB3BOUAlD/K/ZSJZoZoufPblmUj12r/mOwkW2JN+ETV4UA73cTREQMDiXsNmm1v9Y/OSo/dYj3u4fq+lA+gTKFgZH0ccq99rJrr90A88ic6pL0Wh7VBP7zywmUU43FF7fcB+ClbI5t+qGx60ua3TexEpAh4jz6Inrfhp8VvXVvdOlrkzi8JgrQufptvFVTu8wb+aBtszluDooE34K0lSe6ceVGl6Dyszvi4aqKdtgmIF7lwlCfBzhMC+U4Ce50NUB5ooAjLOyaLL2xslTz3mPcJtz5yyMizc43wZJCqrVzB0hrdlvHluo1ovc5X0t9lGhk4BfxtrihPHMKF2V+k2+5PvaMzAdY+GAlZlhj1cWDhuaiNMGhgjyMR30JfHYDwyEDrK3d3uRqILuQMG7/Ach7WyxBrfYaj8XnlVggIOZ+RMU/KPBKyAhwAg7epYH5Eha7M/wPC20Pm08l3aInokh+JlRQizvb6/Enq+GFNOUQxSDMaMidQ3NsgEYzq24RQn3J+904dJwkaCnvwg4gFQE+KU4QA26+wcinLEZuJWLkCLDLMN9xdnfoL40LmujQVc4c9X2jQiApuTqr5JP8pxFfVRlcrCZ3abxgJ7K8kPV3U4peTZAq4c0+lFjmxxDY8n+L2dks2g+rTkqmGx7sqIa8IxC6fqGI7ASfCcJJN8eu/FN+E2HXt+wpJvKkxGdoLcMd5CB8j70H2asZ8nHDHCdKReQf5Rqvez3phGGghW07iPQwx+7xvT15tZCnZazP6FvETZdZ7PVH+gqx43Jmswlf9Ym84Cqoj4821lspvPMMjGwaLRsd61c8P6o3Esv0UQYaz6pdutDitz2SZyFkuugrnLSOkzh9ch7c35ZOoWI1Pzfv0F8Obm7SdP/lbbFkLs0cWet2MtIB7E+VzAzT5DGnBHjBzVIwRG5Ved4/k6xksL8XFoLl2T7OIHI4GsIuI/brUJvULK3iyVt/9p5l6xnRQoRwoSzw+zGHqI0RbO/Hpri5D/bG4IiFbB9dQTJLGm9q98nzShCAcmdGRnkVXUAtIWDM8eTpZsWQwRJ/YbrPF+Dnmb+OV1j40QzL1XkAGK3YYjbxKFYBDAM9VsnZCSbsH0hJRTdJc/5TXgD/UirDaP7L9l9JYpbyNPT50/2XCYlJT5BK7AwdiH4uAcVHFVP0nS7if43A4ma8X6R2HOPDXyUFVf0fCOiZaUfnZQfJHLTwXbcKHQzvrctP2fQ7d2Yfrv7E5I6K1uxDCHug+/F8GKqA/4mam6RnGfg2vT7DnkAPQ4zlONwYGfkCtmGMigaBasRCzRQg9wJ8XYurRBhLVnNHxaoVQiZTQcMiOkFKV7F9yQvOOdK0fHTvDZ8NIG1vIWDBYwrx4KS/0iRRZ/F0hglZNgzOr0p/elO8Gdzj/NEdP5ErSFOes/uj8twPo9PknyMiqEb0Unt9zwHEOOGY94eBNF7Xr9sTbm4+7QDvfkiGIFO4WQdqUPkEjF/YO X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a2805cf0-6ca7-4903-b067-08dba25e7dc8 X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2023 15:51:32.6154 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: savBfgsPV6N9sZ/vHEQlMA/Oct4iBu4dBCSIseUuUrP2Z10kQ92OeR1xukJ8VNcG6RoTjEuMgl/46k1xxVQHvQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB9952 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This adds support for BAP broadcast sink, creates a remote endpoint when a broadcast source is discovered and synchronizes with the source upon endpoint configuration. This feature was tested using bluetoothctl with the following commands: [bluetooth]# endpoint.register 00001851-0000-1000-8000-00805f9b34fb 0x06 [bluetooth]# scan on [NEW] Endpoint /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_bcast0 [bluetooth]# endpoint.config /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_bcast0 /local/endpoint/ep0 16_2_1 --- src/shared/bap.c | 266 ++++++++++++++++++++++++++++++++++++++++++----- src/shared/bap.h | 13 ++- 2 files changed, 251 insertions(+), 28 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 72ce67c08..d548b7734 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -633,14 +633,18 @@ static struct bt_bap_endpoint *bap_endpoint_new(struct bt_bap_db *bdb, return ep; } -static struct bt_bap_endpoint *bap_endpoint_new_broacast(struct bt_bap_db *bdb) +static struct bt_bap_endpoint *bap_endpoint_new_broadcast(struct bt_bap_db *bdb, + uint8_t type) { struct bt_bap_endpoint *ep; ep = new0(struct bt_bap_endpoint, 1); ep->bdb = bdb; ep->attr = NULL; - ep->dir = BT_BAP_BCAST_SOURCE; + if (type == BT_BAP_BCAST_SINK) + ep->dir = BT_BAP_BCAST_SOURCE; + else + ep->dir = BT_BAP_BCAST_SINK; return ep; } @@ -667,22 +671,27 @@ static struct bt_bap_endpoint *bap_get_endpoint(struct queue *endpoints, return ep; } +static bool match_ep_type(const void *data, const void *match_data) +{ + const struct bt_bap_endpoint *ep = data; + const uint8_t type = PTR_TO_INT(match_data); + + return (ep->dir == type); +} + static struct bt_bap_endpoint *bap_get_endpoint_bcast(struct queue *endpoints, - struct bt_bap_db *db) + struct bt_bap_db *db, uint8_t type) { struct bt_bap_endpoint *ep; if (!db) return NULL; - /* - * We have support for only one stream so we will have - * only one endpoint. - * TO DO add support for more then one stream - */ - if (queue_length(endpoints) > 0) - return queue_peek_head(endpoints); - ep = bap_endpoint_new_broacast(db); + ep = queue_find(endpoints, match_ep_type, INT_TO_PTR(type)); + if (ep) + return ep; + + ep = bap_endpoint_new_broadcast(db, type); if (!ep) return NULL; @@ -1317,6 +1326,8 @@ static void stream_set_state_broadcast(struct bt_bap_stream *stream, struct bt_bap *bap = stream->bap; const struct queue_entry *entry; + if (ep->old_state == state) + return; ep->old_state = ep->state; ep->state = state; @@ -1348,6 +1359,9 @@ static void stream_set_state(struct bt_bap_stream *stream, uint8_t state) ep->old_state = ep->state; ep->state = state; + if (stream->lpac->type == BT_BAP_BCAST_SINK) + goto done; + if (stream->client) goto done; @@ -2379,6 +2393,10 @@ static struct bt_bap_pac *bap_pac_find(struct bt_bap_db *bdb, uint8_t type, return queue_find(bdb->sources, match_codec, codec); case BT_BAP_SINK: return queue_find(bdb->sinks, match_codec, codec); + case BT_BAP_BCAST_SOURCE: + return queue_find(bdb->broadcast_sources, match_codec, codec); + case BT_BAP_BCAST_SINK: + return queue_find(bdb->broadcast_sinks, match_codec, codec); } return NULL; @@ -2428,10 +2446,12 @@ static struct bt_bap_pac *bap_pac_new(struct bt_bap_db *bdb, const char *name, pac->bdb = bdb; pac->name = name ? strdup(name) : NULL; pac->type = type; - pac->codec = *codec; - pac->data = util_iov_dup(data, 1); - pac->metadata = util_iov_dup(metadata, 1); - + if (codec) + pac->codec = *codec; + if (data) + pac->data = util_iov_dup(data, 1); + if (metadata) + pac->metadata = util_iov_dup(metadata, 1); if (qos) pac->qos = *qos; @@ -2518,7 +2538,7 @@ struct bt_bap_pac *bt_bap_add_vendor_pac(struct gatt_db *db, struct iovec *metadata) { struct bt_bap_db *bdb; - struct bt_bap_pac *pac, *pac_brodcast_sink; + struct bt_bap_pac *pac, *pac_broadcast_sink; struct bt_bap_codec codec; if (!db) @@ -2545,11 +2565,19 @@ struct bt_bap_pac *bt_bap_add_vendor_pac(struct gatt_db *db, bap_add_source(pac); break; case BT_BAP_BCAST_SOURCE: - // For broadcast add local pac and remote pac bap_add_broadcast_source(pac); - pac_brodcast_sink = bap_pac_new(bdb, name, type, &codec, qos, + if (queue_isempty(bdb->broadcast_sinks)) { + /* When adding a local broadcast source, add also a + * local broadcast sink + */ + pac_broadcast_sink = bap_pac_new(bdb, name, + BT_BAP_BCAST_SINK, &codec, qos, data, metadata); - bap_add_broadcast_sink(pac_brodcast_sink); + bap_add_broadcast_sink(pac_broadcast_sink); + } + break; + case BT_BAP_BCAST_SINK: + bap_add_broadcast_sink(pac); break; default: bap_pac_free(pac); @@ -2923,6 +2951,103 @@ bool bap_print_cc(void *data, size_t len, util_debug_func_t func, return bap_print_ltv("CC", data, len, func, user_data); } +bool bap_parse_base(void *data, size_t len, util_debug_func_t func, + uint32_t *presDelay, uint8_t *numSubgroups, uint8_t *numBis, + struct bt_bap_codec *codec, struct iovec **caps, + struct iovec **meta) +{ + struct iovec iov = { + .iov_base = data, + .iov_len = len, + }; + + uint8_t capsLen, metaLen; + uint8_t *hexstream; + + if (presDelay) { + if (!util_iov_pull_le24(&iov, presDelay)) + return false; + util_debug(func, NULL, "PresentationDelay %d", *presDelay); + } + + if (numSubgroups) { + if (!util_iov_pull_u8(&iov, numSubgroups)) + return false; + util_debug(func, NULL, "NumSubgroups %d", *numSubgroups); + } + + if (numBis) { + if (!util_iov_pull_u8(&iov, numBis)) + return false; + util_debug(func, NULL, "NumBis %d", *numBis); + } + + if (codec) { + codec = util_iov_pull_mem(&iov, sizeof(*codec)); + if (!codec) + return false; + util_debug(func, NULL, "%s: ID %d CID 0x%2.2x VID 0x%2.2x", + "Codec", codec->id, codec->cid, codec->vid); + } + + if (!util_iov_pull_u8(&iov, &capsLen)) + return false; + util_debug(func, NULL, "CC Len %d", capsLen); + + if (!capsLen) + return false; + if (caps) { + if (!(*caps)) + *caps = new0(struct iovec, 1); + (*caps)->iov_len = capsLen; + (*caps)->iov_base = iov.iov_base; + } + + for (int i = 0; capsLen > 1; i++) { + struct bt_ltv *ltv = util_iov_pull_mem(&iov, sizeof(*ltv)); + uint8_t *caps; + + if (!ltv) { + util_debug(func, NULL, "Unable to parse %s", + "Capabilities"); + return false; + } + + util_debug(func, NULL, "%s #%u: len %u type %u", + "CC", i, ltv->len, ltv->type); + + caps = util_iov_pull_mem(&iov, ltv->len - 1); + if (!caps) { + util_debug(func, NULL, "Unable to parse %s", + "CC"); + return false; + } + util_hexdump(' ', caps, ltv->len - 1, func, NULL); + + capsLen -= (ltv->len + 1); + } + + if (!util_iov_pull_u8(&iov, &metaLen)) + return false; + util_debug(func, NULL, "Metadata Len %d", metaLen); + + if (!metaLen) + return false; + if (meta) { + if (!(*meta)) + *meta = new0(struct iovec, 1); + (*meta)->iov_len = metaLen; + (*meta)->iov_base = iov.iov_base; + } + + hexstream = util_iov_pull_mem(&iov, metaLen); + if (!hexstream) + return false; + util_hexdump(' ', hexstream, metaLen, func, NULL); + + return true; +} + static void bap_parse_pacs(struct bt_bap *bap, uint8_t type, struct queue *queue, const uint8_t *value, @@ -4008,7 +4133,8 @@ bool bt_bap_attach_broadcast(struct bt_bap *bap) queue_push_tail(sessions, bap); - ep = bap_get_endpoint_bcast(bap->remote_eps, bap->ldb); + ep = bap_get_endpoint_bcast(bap->remote_eps, bap->ldb, + BT_BAP_BCAST_SOURCE); if (ep) ep->bap = bap; @@ -4198,7 +4324,11 @@ static void bap_foreach_pac(struct queue *l, struct queue *r, for (er = queue_get_entries(r); er; er = er->next) { struct bt_bap_pac *rpac = er->data; - if (!bap_codec_equal(&lpac->codec, &rpac->codec)) + /* Skip checking codec for bcast source, + * it will be checked when BASE info are received + */ + if ((rpac->type != BT_BAP_BCAST_SOURCE) && + (!bap_codec_equal(&lpac->codec, &rpac->codec))) continue; if (!func(lpac, rpac, user_data)) @@ -4221,9 +4351,19 @@ void bt_bap_foreach_pac(struct bt_bap *bap, uint8_t type, return bap_foreach_pac(bap->ldb->sinks, bap->rdb->sources, func, user_data); case BT_BAP_BCAST_SOURCE: - return bap_foreach_pac(bap->ldb->broadcast_sources, + if (queue_isempty(bap->rdb->broadcast_sources) + && queue_isempty(bap->rdb->broadcast_sinks)) + return bap_foreach_pac(bap->ldb->broadcast_sources, bap->ldb->broadcast_sinks, func, user_data); + + return bap_foreach_pac(bap->ldb->broadcast_sinks, + bap->rdb->broadcast_sources, + func, user_data); + case BT_BAP_BCAST_SINK: + return bap_foreach_pac(bap->ldb->broadcast_sinks, + bap->rdb->broadcast_sources, + func, user_data); } } @@ -4243,10 +4383,10 @@ int bt_bap_pac_get_vendor_codec(struct bt_bap_pac *pac, uint8_t *id, if (vid) *vid = pac->codec.cid; - if (data) + if (data && pac->data) *data = pac->data; - if (metadata) + if (metadata && pac->metadata) *metadata = pac->metadata; return 0; @@ -4382,6 +4522,11 @@ unsigned int bt_bap_stream_config(struct bt_bap_stream *stream, return req->id; case BT_BAP_STREAM_TYPE_BCAST: stream->qos = *qos; + if (stream->lpac->type == BT_BAP_BCAST_SINK) { + if (data) + stream_config(stream, data, NULL); + stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG); + } return 1; } @@ -4434,7 +4579,8 @@ struct bt_bap_stream *bt_bap_stream_new(struct bt_bap *bap, return NULL; if (lpac && rpac) { - if (!bap_codec_equal(&lpac->codec, &rpac->codec)) + if ((rpac->type != BT_BAP_BCAST_SOURCE) + && (!bap_codec_equal(&lpac->codec, &rpac->codec))) return NULL; } else { uint8_t type; @@ -4446,13 +4592,19 @@ struct bt_bap_stream *bt_bap_stream_new(struct bt_bap *bap, if (rpac) type = rpac->type; else if (lpac) { - switch(lpac->type) { + switch (lpac->type) { case BT_BAP_SINK: type = BT_BAP_SOURCE; break; case BT_BAP_SOURCE: type = BT_BAP_SINK; break; + case BT_BAP_BCAST_SOURCE: + type = BT_BAP_BCAST_SINK; + break; + case BT_BAP_BCAST_SINK: + type = BT_BAP_BCAST_SOURCE; + break; default: return NULL; } @@ -4913,6 +5065,13 @@ struct io *bt_bap_stream_get_io(struct bt_bap_stream *stream) return io->io; } +bool bt_bap_match_bcast_sink_stream(const void *data, const void *user_data) +{ + const struct bt_bap_stream *stream = data; + + return stream->lpac->type == BT_BAP_BCAST_SINK; +} + static bool stream_io_disconnected(struct io *io, void *user_data) { struct bt_bap_stream *stream = user_data; @@ -4944,6 +5103,14 @@ static bool match_req_id(const void *data, const void *match_data) return (req->id == id); } +static bool match_name(const void *data, const void *match_data) +{ + const struct bt_bap_pac *pac = data; + const char *name = match_data; + + return (!strcmp(pac->name, name)); +} + int bt_bap_stream_cancel(struct bt_bap_stream *stream, unsigned int id) { struct bt_bap_req *req; @@ -5132,3 +5299,50 @@ bool bt_bap_stream_io_is_connecting(struct bt_bap_stream *stream, int *fd) return io->connecting; } + +bool bt_bap_new_bcast_source(struct bt_bap *bap, const char *name) +{ + struct bt_bap_endpoint *ep; + struct bt_bap_pac *pac_broadcast_source; + + /* Add the remote source only if a local sink endpoint was registered */ + if (queue_isempty(bap->ldb->broadcast_sinks)) + return false; + + /* Add the remote source only if a local sink endpoint was registered */ + if (queue_isempty(bap->ldb->broadcast_sinks)) + return false; + + /* Add remote source endpoint */ + if (!bap->rdb->broadcast_sources) + bap->rdb->broadcast_sources = queue_new(); + + if (queue_find(bap->rdb->broadcast_sources, match_name, name)) + return true; + + pac_broadcast_source = bap_pac_new(bap->rdb, name, BT_BAP_BCAST_SOURCE, + NULL, NULL, NULL, NULL); + queue_push_tail(bap->rdb->broadcast_sources, pac_broadcast_source); + + if (!pac_broadcast_source) + return false; + + queue_foreach(bap->pac_cbs, notify_pac_added, pac_broadcast_source); + + /* Push remote endpoint with direction sink */ + ep = bap_endpoint_new_broadcast(bap->rdb, BT_BAP_BCAST_SINK); + + if (ep) + queue_push_tail(bap->remote_eps, ep); + + return true; +} + +void bt_bap_update_bcast_source(struct bt_bap_pac *pac, + struct bt_bap_codec *codec, + struct iovec *data, + struct iovec *metadata) +{ + bap_pac_merge(pac, data, metadata); + pac->codec = *codec; +} diff --git a/src/shared/bap.h b/src/shared/bap.h index 50b567663..8a8be9495 100644 --- a/src/shared/bap.h +++ b/src/shared/bap.h @@ -194,7 +194,10 @@ bool bt_bap_set_debug(struct bt_bap *bap, bt_bap_debug_func_t cb, bool bap_print_cc(void *data, size_t len, util_debug_func_t func, void *user_data); - +bool bap_parse_base(void *data, size_t len, util_debug_func_t func, + uint32_t *presDelay, uint8_t *numSubgroups, uint8_t *numBis, + struct bt_bap_codec *codec, struct iovec **caps, + struct iovec **meta); unsigned int bt_bap_pac_register(struct bt_bap *bap, bt_bap_pac_func_t added, bt_bap_pac_func_t removed, void *user_data, bt_bap_destroy_func_t destroy); @@ -289,7 +292,7 @@ struct bt_bap_qos *bt_bap_stream_get_qos(struct bt_bap_stream *stream); struct iovec *bt_bap_stream_get_metadata(struct bt_bap_stream *stream); struct io *bt_bap_stream_get_io(struct bt_bap_stream *stream); - +bool bt_bap_match_bcast_sink_stream(const void *data, const void *user_data); bool bt_bap_stream_set_io(struct bt_bap_stream *stream, int fd); int bt_bap_stream_cancel(struct bt_bap_stream *stream, unsigned int id); @@ -305,3 +308,9 @@ uint8_t bt_bap_stream_io_dir(struct bt_bap_stream *stream); int bt_bap_stream_io_connecting(struct bt_bap_stream *stream, int fd); bool bt_bap_stream_io_is_connecting(struct bt_bap_stream *stream, int *fd); + +bool bt_bap_new_bcast_source(struct bt_bap *bap, const char *name); +void bt_bap_update_bcast_source(struct bt_bap_pac *pac, + struct bt_bap_codec *codec, + struct iovec *data, + struct iovec *metadata); From patchwork Mon Aug 21 15:51:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudia Draghicescu X-Patchwork-Id: 13359590 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 72540EE49AA for ; Mon, 21 Aug 2023 15:51:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236462AbjHUPvm (ORCPT ); Mon, 21 Aug 2023 11:51:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236237AbjHUPvl (ORCPT ); Mon, 21 Aug 2023 11:51:41 -0400 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2064.outbound.protection.outlook.com [40.107.241.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E0F9F1 for ; Mon, 21 Aug 2023 08:51:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yb9oIlLwfjUKq3FqrHO8qnUoJdW4jGUP13DjszdeDNX+bRQCxjG1MtyE9mjjcNsF+Fz1VllrjlUOiA2rzcVvflnoJQi2mF2uZ6N8Bulk72+ZrfzPNh7TxcjQFLa43z0JlAwc3aD2sNzJwVhCwMGUW3J5uNSHhZxlo4XaEbfM8bChaZgUilt1gJoLn4ZChwFH2AqCCdk2voG4wS1ZhoPifDPIjddN4W5EgNziDx5MDE9cQtdXVhR5U41nX/XrzORzuyzKNQKWGUzG3hf6h4WcSD58ZxfOXeDfvjE6FoLvznPMWHcMLIsAqKhR9/OzXplTiJl6EM+H7vzRb//eWTmDZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9UsPKt6Zv5B0rP9rpjOnZ3FPsObhSZASkjFInhC92CU=; b=YMekDocWflDhEng2tOCFcpOTgbk0V88LcieppXH2J6Ex+9vWJs6rw7aT4K1uw/0cpa/y0AmsieJm1cpeElvUX8PGlIbY9Rq9qRzPbA/kNcwbu+4BXz5s+IELZRa/99/7RGIE7FxCyL/T1PZ2BkO5faHkwaTPsq7LWQTxjtoaHuJT6pjZqFxQhuBSlZlGp0l2U4BnTiYrKciHY4YeKQi9oQWQ9xA0vD3woWoYmKDFVLHZGK078zFKzGkUc7zB7lLF9lbLY2tsYIQKSnphasg2Ujt7MnyL+j9N4XX2yhlxO+31Y97UbE/ahp/DRmkFBcFyWX1k99xYoSyzRADfDz5PIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9UsPKt6Zv5B0rP9rpjOnZ3FPsObhSZASkjFInhC92CU=; b=j0arvLOA31Znl5Qfv1bQNqbpJaMuvfjT7Xi4JDl9sMQkdpQRazg5yMUbeMqAdip+rvQbb+3FrsAC/HE3cDfpJOinzenFtroGd7SQt9RfYyH3EJXLxu+xPDCyJat3GINxqozTWKBqPLCUgjyTgRqMsqYBJQ++S2wGhRssdK6W4Mc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9151.eurprd04.prod.outlook.com (2603:10a6:150:26::9) by GVXPR04MB9952.eurprd04.prod.outlook.com (2603:10a6:150:117::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20; Mon, 21 Aug 2023 15:51:36 +0000 Received: from GV1PR04MB9151.eurprd04.prod.outlook.com ([fe80::c2fe:9eef:61ea:36d9]) by GV1PR04MB9151.eurprd04.prod.outlook.com ([fe80::c2fe:9eef:61ea:36d9%7]) with mapi id 15.20.6699.020; Mon, 21 Aug 2023 15:51:35 +0000 From: Claudia Draghicescu To: linux-bluetooth@vger.kernel.org Cc: iulia.tanasescu@nxp.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, Claudia Draghicescu Subject: [PATCH BlueZ v7 2/6] bap: Add support for BAP broadcast sink Date: Mon, 21 Aug 2023 18:51:00 +0300 Message-Id: <20230821155104.86954-3-claudia.rosu@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230821155104.86954-1-claudia.rosu@nxp.com> References: <20230821155104.86954-1-claudia.rosu@nxp.com> X-ClientProxiedBy: AM0PR04CA0127.eurprd04.prod.outlook.com (2603:10a6:208:55::32) To GV1PR04MB9151.eurprd04.prod.outlook.com (2603:10a6:150:26::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9151:EE_|GVXPR04MB9952:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e007588-d7a4-4afd-a876-08dba25e7fbf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Qgf1L9bp4fMW/XRoDVjhJrUk5Ky/rMLLCp/Zuw8odp+lb2wtYHpKz80U+So4AWALuc6swzsooEctCN0Vc93xOE5McIGe8Z7tXsZ6S0a9nVyCqR547zH8XcVuQEuV/9nabLB5LVeGAH3HE8XTJgJqYbOfguzRv+QpL4Tr2Jw8hFR3IKACR8hiyexjf1E31iX+AwFhMys0LtLZ8yy56bM25Tjm4RHuTCfSj/5IGMd2SQ9MGwJqR63Z/brmEmpE+mQ3oI4p8/gPI4oou0ybg/sSwFd2CQpoO/VQCtjV+WP64iZeHCE9wZxsovTre2VA82JX0x/F7cnlpEvHMtv79uynjw6B1CLtRWG7mLpBu0i/MT8CgoG+peQllPHmD2IzJEsPvvSOMYzwvb+nqHC6u0vzOhWAfKQnnAUM5/Y4UIBt5e112hF/8EHjbRMeuo0fjBH09GCPbhzRz2pMpJqO2hToVdqVLQVgvLscf+7dHCey62/tTffMG7nnEyOtP7/b1HVy1+QiM0ZnOdHzk+3cJTRLpxr6okdd++f907pdFkJq3L8kBDYqzNr4HulD4DBMRNjfz3O/Chs7jKfAmDZ/FoFHGTx9rGLlRcimalGFs0xAGqlH1/spGgy6mWn1qSqtl1D/ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV1PR04MB9151.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(366004)(39860400002)(376002)(136003)(396003)(451199024)(186009)(1800799009)(2906002)(30864003)(52116002)(38350700002)(38100700002)(6506007)(6486002)(83380400001)(5660300002)(26005)(86362001)(8676002)(2616005)(8936002)(4326008)(316002)(66946007)(6512007)(6916009)(66556008)(66476007)(478600001)(6666004)(36756003)(41300700001)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gbGOSEkq93wQK9s/pnnbN1CF/I9sYzVFpWluIuRJrcc1TQtQdGQ3tsFJCQE3C6EjIdrltUWlWoXa+RKJKZKeXGvsys2s6QmIo8JgMN4PqrWoH1XsCZXIdGfZlfTBQcg8FT8ycsUa/IfTrpVAoZ+R5Ce4ks5bFd3tlmrLyUEdG4B/bdltbErQdvOJ12fUGdcAB31F6a0Muz7TpZBfaQGaZwVSnswdzH9m3xBL6QphcNCyDFW3Ozd4idWFHu8CQmLJ/mdPscm8QjENV5gASeCMvF+gsKLnhU/an/pu/c1dsVSf0aZdi5SKIMYR+khHeTiPSVOouR+kZHlTGGypncrflhX/C6IiYH92+aRYVYmJz7pG4elN/2doMyvC7gZSs4LsU3P7dlt5QIVS1IDVRZKnu4OGCGpk9SIv9ZfGX2U8hKw3o3qXhC2NbKmube6Af5oRA0zRBZfgxYWMPJnMIVnFjnzVclzfq/TXYWqsLinYygfck+mwhQaY6kze4F6tDSs9Z4wESbc1z7EfhdB8XmiQUi8xDrQ1r/ACp303Ob0NYwjRlId/TbVV/v/fBFQT8Fri7447WXuHkRGVDhWtb2aLN+oUcmkjyAOtX/0veZqtQ3lVqmXWwR8u8cCgb00gz0r3aItDVl+0wz8IcjX5UTe6yuMShKkfosbJy+AqrviTK/K87NMpuqg5QArDBYx6a1M5qGE8U18hu6pKYt7KxNTrCOSqRouiswsUMw/tzOmPRgPqrycvC3ru6B3hOdV++vBuxCmamA/RBsFy9pCpY5i8ofvh0FxbbiHOx4/N/bWaRnXt6enSkmjLAuhZ8YH421CNYXHf90eYZHwoUBVPdlLo2Li2jjK40l/gNFowKnzle3jkQZwEou+dJ+ptWsd5JCSpc/k0LAgc9Pz5oh79icby+EfRTsPQJ+MKl7qQY3nUDAw8ok+RUpf05dEMtUwoS/W5wfrJH0FVDzSoseHv4n33752XsesiUR6CXFwHuNwZ1E9asMvC8qhDMd2QxdKzIxveJM4Wa6jdIg9ByXHpDuBqT2j4X2IMOddihYuHTdHGIs6ObokGCqfYAgc3QEKvoqwqdPI+wQNcCglkmEp1dVKTOJlrmnMPlCsmX/YmGUBxDNbzC1rpzyLPP/4F8dgbtuH37gTwh9ibfREa03fyKNrt/eNszoBice+71csbRGhm3X6RqT1pebMjHEonZveAe1dpGx8BjqY6L6T3WWNrWRplnPIYb692kv4G3fvxwxiOYDRBYy7Xx8O6TCvEo53ybSexjTBXPDwBwAXmCdrs4pvJgXoN0pXS70yv6bhCKdDT7UJFdjfUtT9FWrmIq7RBmOi1sAT/z0yQda1mhq5cAfdfFDXH2+w6c0DEL4b37JNFmm7IUDJCuFpDvctdwDptYovm35o2IIH4gMw6gF6ER/h6UvT0dBTbUBxHoh92ZYwLkHmsYS6GNJ1dKhCVfNNUFm3HfwfUO+7wxcO/4GKxCKtgQquH38mMvR7k/h+rp6Kd1Eh6sggyussU5SuZAYwFEG2iZebHx9jpwfPJDjVRJRi7s9vXN0kk4QOvcR5/ugm+XzYlcSZarTejgwdxR4AM04Ed X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e007588-d7a4-4afd-a876-08dba25e7fbf X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2023 15:51:35.8407 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GCg0wcpc0ZQFs2zzZ3UB9bTmEjGixueZwJeESXd2gZ5F3E9+pm3KOiKI3OQrsJ2VhL2z8eiH/4iz5S58lPOZxw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB9952 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This adds support for BAP broadcast sink, creates a remote endpoint when a broadcast source is discovered and synchronizes with the source upon endpoint configuration. This feature was tested using bluetoothctl with the following commands: [bluetooth]# endpoint.register 00001851-0000-1000-8000-00805f9b34fb 0x06 [bluetooth]# scan on [NEW] Endpoint /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_bcast0 [bluetooth]# endpoint.config /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_bcast0 /local/endpoint/ep0 16_2_1 --- profiles/audio/bap.c | 312 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 286 insertions(+), 26 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 922eac50d..187140232 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -34,6 +34,7 @@ #include "lib/hci.h" #include "lib/sdp.h" #include "lib/uuid.h" +#include "lib/iso.h" #include "src/btd.h" #include "src/dbus-common.h" @@ -57,7 +58,9 @@ #define ISO_SOCKET_UUID "6fbaf188-05e0-496a-9885-d6ddfdb4e03e" #define PACS_UUID_STR "00001850-0000-1000-8000-00805f9b34fb" +#define BCAAS_UUID_STR "00001852-0000-1000-8000-00805f9b34fb" #define MEDIA_ENDPOINT_INTERFACE "org.bluez.MediaEndpoint1" +#define MEDIA_INTERFACE "org.bluez.Media1" struct bap_ep { char *path; @@ -186,6 +189,9 @@ static gboolean get_uuid(const GDBusPropertyTable *property, uuid = PAC_SINK_UUID; else if (queue_find(ep->data->srcs, NULL, ep)) uuid = PAC_SOURCE_UUID; + else if ((queue_find(ep->data->bcast, NULL, ep) + && (bt_bap_pac_get_type(ep->lpac) == BT_BAP_BCAST_SINK))) + uuid = BCAA_SERVICE_UUID; else uuid = BAA_SERVICE_UUID; @@ -207,6 +213,19 @@ static gboolean get_codec(const GDBusPropertyTable *property, return TRUE; } +static gboolean has_capabilities(const GDBusPropertyTable *property, void *data) +{ + struct bap_ep *ep = data; + struct iovec *d = NULL; + + bt_bap_pac_get_codec(ep->rpac, NULL, &d, NULL); + + if (d) + return TRUE; + + return FALSE; +} + static gboolean get_capabilities(const GDBusPropertyTable *property, DBusMessageIter *iter, void *data) { @@ -248,7 +267,7 @@ static const GDBusPropertyTable ep_properties[] = { G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, { "Codec", "y", get_codec, NULL, NULL, G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, - { "Capabilities", "ay", get_capabilities, NULL, NULL, + { "Capabilities", "ay", get_capabilities, NULL, has_capabilities, G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, { "Device", "o", get_device, NULL, NULL, G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, @@ -556,7 +575,7 @@ static DBusMessage *set_configuration(DBusConnection *conn, DBusMessage *msg, } if (bt_bap_pac_get_type(ep->lpac) == BT_BAP_BCAST_SOURCE) { - /* Mark CIG and CIS to be auto assigned */ + /* Mark BIG and BIS to be auto assigned */ ep->qos.bcast.big = BT_ISO_QOS_BIG_UNSET; ep->qos.bcast.bis = BT_ISO_QOS_BIS_UNSET; } else { @@ -597,13 +616,126 @@ static DBusMessage *set_configuration(DBusConnection *conn, DBusMessage *msg, break; case BT_BAP_STREAM_TYPE_BCAST: /* No message sent over the air for broadcast */ - ep->id = 0; + if (bt_bap_pac_get_type(ep->lpac) == BT_BAP_BCAST_SINK) + ep->msg = dbus_message_ref(msg); + else + ep->id = 0; + return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); } return NULL; } +static void update_bcast_qos(struct bt_iso_qos *qos, + struct bt_bap_qos *bap_qos) +{ + bap_qos->bcast.big = qos->bcast.big; + bap_qos->bcast.bis = qos->bcast.bis; + bap_qos->bcast.sync_interval = qos->bcast.sync_interval; + bap_qos->bcast.packing = qos->bcast.packing; + bap_qos->bcast.framing = qos->bcast.framing; + bap_qos->bcast.encryption = qos->bcast.encryption; + bap_qos->bcast.options = qos->bcast.options; + bap_qos->bcast.skip = qos->bcast.skip; + bap_qos->bcast.sync_timeout = qos->bcast.sync_timeout; + bap_qos->bcast.sync_cte_type = qos->bcast.sync_cte_type; + bap_qos->bcast.mse = qos->bcast.mse; + bap_qos->bcast.timeout = qos->bcast.timeout; + bap_qos->bcast.io_qos.interval = qos->bcast.in.interval; + bap_qos->bcast.io_qos.latency = qos->bcast.in.latency; + bap_qos->bcast.io_qos.phy = qos->bcast.in.phy; + bap_qos->bcast.io_qos.sdu = qos->bcast.in.sdu; + bap_qos->bcast.io_qos.rtn = qos->bcast.in.rtn; + + bap_qos->bcast.bcode = new0(struct iovec, 1); + util_iov_memcpy(bap_qos->bcast.bcode, qos->bcast.bcode, + sizeof(qos->bcast.bcode)); +} + +static bool match_ep_type(const void *data, const void *user_data) +{ + const struct bap_ep *ep = data; + + return (bt_bap_pac_get_type(ep->lpac) == PTR_TO_INT(user_data)); +} + +static void iso_bcast_confirm_cb(GIOChannel *io, GError *err, void *user_data) +{ + struct bap_data *data = user_data; + struct bt_iso_qos qos; + struct bt_iso_base base; + char address[18]; + struct bap_ep *ep; + int fd; + struct iovec *base_io; + uint32_t presDelay; + uint8_t numSubgroups; + uint8_t numBis; + struct bt_bap_codec codec; + + bt_io_get(io, &err, + BT_IO_OPT_DEST, address, + BT_IO_OPT_QOS, &qos, + BT_IO_OPT_BASE, &base, + BT_IO_OPT_INVALID); + if (err) { + error("%s", err->message); + g_error_free(err); + goto drop; + } + + g_io_channel_ref(io); + btd_service_connecting_complete(data->service, 0); + DBG("BCAST ISO: sync with %s (BIG 0x%02x BIS 0x%02x)", + address, qos.bcast.big, qos.bcast.bis); + + ep = queue_find(data->bcast, match_ep_type, + INT_TO_PTR(BT_BAP_BCAST_SINK)); + if (!ep) + return; + + update_bcast_qos(&qos, &ep->qos); + + base_io = new0(struct iovec, 1); + util_iov_memcpy(base_io, base.base, base.base_len); + + bap_parse_base(base_io->iov_base, base_io->iov_len, bap_debug, + &presDelay, &numSubgroups, &numBis, + &codec, &ep->caps, &ep->metadata); + + /* Update pac with BASE information */ + bt_bap_update_bcast_source(ep->rpac, &codec, ep->caps, ep->metadata); + ep->id = bt_bap_stream_config(ep->stream, &ep->qos, + ep->caps, NULL, NULL); + data->listen_io = io; + + bt_bap_stream_set_user_data(ep->stream, ep->path); + + fd = g_io_channel_unix_get_fd(io); + + if (bt_bap_stream_set_io(ep->stream, fd)) { + bt_bap_stream_enable(ep->stream, true, NULL, NULL, NULL); + g_io_channel_set_close_on_unref(io, FALSE); + return; + } + + + return; + +drop: + g_io_channel_shutdown(io, TRUE, NULL); + +} + +static bool match_data_bap_data(const void *data, const void *match_data) +{ + const struct bap_data *bdata = data; + const struct btd_adapter *adapter = match_data; + + return bdata->user_data == adapter; +} + static const GDBusMethodTable ep_methods[] = { { GDBUS_EXPERIMENTAL_ASYNC_METHOD("SetConfiguration", GDBUS_ARGS({ "endpoint", "o" }, @@ -649,15 +781,17 @@ static struct bap_ep *ep_register_bcast(struct bap_data *data, struct bt_bap_pac *lpac, struct bt_bap_pac *rpac) { - struct btd_adapter *adapter = data->user_data; + struct btd_adapter *adapter = data->adapter; + struct btd_device *device = data->device; struct bap_ep *ep; struct queue *queue; - int i, err; + int i, err = 0; const char *suffix; struct match_ep match = { lpac, rpac }; switch (bt_bap_pac_get_type(rpac)) { case BT_BAP_BCAST_SOURCE: + case BT_BAP_BCAST_SINK: queue = data->bcast; i = queue_length(data->bcast); suffix = "bcast"; @@ -675,8 +809,20 @@ static struct bap_ep *ep_register_bcast(struct bap_data *data, ep->lpac = lpac; ep->rpac = rpac; - err = asprintf(&ep->path, "%s/pac_%s%d", adapter_get_path(adapter), - suffix, i); + if (device) + ep->data->device = device; + + switch (bt_bap_pac_get_type(rpac)) { + case BT_BAP_BCAST_SINK: + err = asprintf(&ep->path, "%s/pac_%s%d", + adapter_get_path(adapter), suffix, i); + break; + case BT_BAP_BCAST_SOURCE: + err = asprintf(&ep->path, "%s/pac_%s%d", + device_get_path(device), suffix, i); + break; + } + if (err < 0) { error("Could not allocate path for remote pac %s/pac%d", adapter_get_path(adapter), i); @@ -685,14 +831,13 @@ static struct bap_ep *ep_register_bcast(struct bap_data *data, } if (g_dbus_register_interface(btd_get_dbus_connection(), - ep->path, MEDIA_ENDPOINT_INTERFACE, - ep_methods, NULL, ep_properties, - ep, ep_free) == FALSE) { + ep->path, MEDIA_ENDPOINT_INTERFACE, + ep_methods, NULL, ep_properties, + ep, ep_free) == FALSE) { error("Could not register remote ep %s", ep->path); ep_free(ep); return NULL; } - bt_bap_pac_set_user_data(rpac, ep->path); DBG("ep %p lpac %p rpac %p path %s", ep, ep->lpac, ep->rpac, ep->path); @@ -824,6 +969,7 @@ done: queue_foreach(ep->data->srcs, bap_config, NULL); queue_foreach(ep->data->snks, bap_config, NULL); + queue_foreach(ep->data->bcast, bap_config, NULL); } static bool pac_found(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac, @@ -1310,6 +1456,45 @@ static void bap_listen_io(struct bap_data *data, struct bt_bap_stream *stream, data->listen_io = io; } +static void bap_listen_io_broadcast(struct bap_data *data, struct bap_ep *ep, + struct bt_bap_stream *stream, struct bt_iso_qos *qos) +{ + GIOChannel *io; + GError *err = NULL; + struct sockaddr_iso_bc iso_bc_addr; + + iso_bc_addr.bc_bdaddr_type = btd_device_get_bdaddr_type(data->device); + memcpy(&iso_bc_addr.bc_bdaddr, device_get_address(data->device), + sizeof(bdaddr_t)); + iso_bc_addr.bc_bis[0] = 1; + iso_bc_addr.bc_num_bis = 1; + + DBG("stream %p", stream); + + /* If IO already set skip creating it again */ + if (bt_bap_stream_get_io(stream) || data->listen_io) + return; + + io = bt_io_listen(iso_bcast_confirm_cb, NULL, ep->data, NULL, &err, + BT_IO_OPT_SOURCE_BDADDR, + btd_adapter_get_address(ep->data->adapter), + BT_IO_OPT_DEST_BDADDR, + device_get_address(data->device), + BT_IO_OPT_DEST_TYPE, + btd_device_get_bdaddr_type(data->device), + BT_IO_OPT_MODE, BT_IO_MODE_ISO, + BT_IO_OPT_QOS, &qos->bcast, + BT_IO_OPT_ISO_BC_NUM_BIS, iso_bc_addr.bc_num_bis, + BT_IO_OPT_ISO_BC_BIS, iso_bc_addr.bc_bis, + BT_IO_OPT_INVALID); + if (!io) { + error("%s", err->message); + g_error_free(err); + } + + ep->data->listen_io = io; + +} static void bap_create_ucast_io(struct bap_data *data, struct bap_ep *ep, struct bt_bap_stream *stream, int defer) { @@ -1364,10 +1549,10 @@ static void bap_create_bcast_io(struct bap_data *data, struct bap_ep *ep, memcpy(&iso_qos.bcast.out, &ep->qos.bcast.io_qos, sizeof(struct bt_iso_io_qos)); done: - if (ep) + if (bt_bap_pac_get_type(ep->lpac) == BT_BAP_BCAST_SOURCE) bap_connect_io_broadcast(data, ep, stream, &iso_qos); else - bap_listen_io(data, stream, &iso_qos); + bap_listen_io_broadcast(data, ep, stream, &iso_qos); } static void bap_create_io(struct bap_data *data, struct bap_ep *ep, @@ -1417,6 +1602,11 @@ static void bap_state(struct bt_bap_stream *stream, uint8_t old_state, break; case BT_BAP_STREAM_STATE_CONFIG: if (ep && !ep->id) { + if + (bt_bap_pac_get_type(ep->lpac) == BT_BAP_BCAST_SINK) { + bap_create_bcast_io(data, ep, stream, true); + return; + } bap_create_io(data, ep, stream, true); if (!ep->io) { error("Unable to create io"); @@ -1424,7 +1614,6 @@ static void bap_state(struct bt_bap_stream *stream, uint8_t old_state, return; } - if (bt_bap_stream_get_type(stream) == BT_BAP_STREAM_TYPE_UCAST) { /* Wait QoS response to respond */ @@ -1475,12 +1664,12 @@ static void pac_added_broadcast(struct bt_bap_pac *pac, void *user_data) { struct bap_data *data = user_data; - if (bt_bap_pac_get_type(pac) == BT_BAP_BCAST_SOURCE) { - DBG("pac %p", pac); - + if (bt_bap_pac_get_type(pac) == BT_BAP_BCAST_SOURCE) bt_bap_foreach_pac(data->bap, BT_BAP_BCAST_SOURCE, pac_found_bcast, data); - } + else if (bt_bap_pac_get_type(pac) == BT_BAP_BCAST_SINK) + bt_bap_foreach_pac(data->bap, BT_BAP_BCAST_SINK, + pac_found_bcast, data); } static bool ep_match_pac(const void *data, const void *match_data) @@ -1596,14 +1785,6 @@ static bool match_data(const void *data, const void *match_data) return bdata->bap == bap; } -static bool match_data_bap_data(const void *data, const void *match_data) -{ - const struct bap_data *bdata = data; - const struct btd_adapter *adapter = match_data; - - return bdata->user_data == adapter; -} - static bool io_get_qos(GIOChannel *io, struct bt_iso_qos *qos) { GError *err = NULL; @@ -1733,6 +1914,71 @@ static void bap_detached(struct bt_bap *bap, void *user_data) bap_data_remove(data); } +static int bap_bcast_probe(struct btd_service *service) +{ + struct btd_device *device = btd_service_get_device(service); + struct btd_adapter *adapter = device_get_adapter(device); + struct btd_gatt_database *database = btd_adapter_get_database(adapter); + struct bap_data *data = btd_service_get_user_data(service); + char addr[18]; + + ba2str(device_get_address(device), addr); + + if (!btd_adapter_has_exp_feature(adapter, EXP_FEAT_ISO_SOCKET)) { + error("BAP requires ISO Socket which is not enabled"); + return -ENOTSUP; + } + + /* Ignore, if we were probed for this device already */ + if (data) { + error("Profile probed twice for the same device!"); + return -EINVAL; + } + + data = bap_data_new(device); + data->service = service; + data->adapter = adapter; + data->device = device; + + data->bap = bt_bap_new(btd_gatt_database_get_db(database), + btd_gatt_database_get_db(database)); + if (!data->bap) { + error("Unable to create BAP instance"); + free(data); + return -EINVAL; + } + + bap_data_add(data); + + data->ready_id = bt_bap_ready_register(data->bap, bap_ready, service, + NULL); + data->state_id = bt_bap_state_register(data->bap, bap_state, + bap_connecting, data, NULL); + data->pac_id = bt_bap_pac_register(data->bap, pac_added_broadcast, + pac_removed_broadcast, data, NULL); + + bt_bap_set_user_data(data->bap, service); + + bt_bap_new_bcast_source(data->bap, device_get_path(device)); + return 0; +} + +static void bap_bcast_remove(struct btd_service *service) +{ + struct btd_device *device = btd_service_get_device(service); + struct bap_data *data; + char addr[18]; + + ba2str(device_get_address(device), addr); + DBG("%s", addr); + + data = btd_service_get_user_data(service); + if (!data) { + error("BAP service not handled by profile"); + return; + } +} + static int bap_probe(struct btd_service *service) { struct btd_device *device = btd_service_get_device(service); @@ -1901,6 +2147,16 @@ static struct btd_profile bap_profile = { .experimental = true, }; +static struct btd_profile bap_bcast_profile = { + .name = "bcaa", + .priority = BTD_PROFILE_PRIORITY_MEDIUM, + .remote_uuid = BCAAS_UUID_STR, + .device_probe = bap_bcast_probe, + .device_remove = bap_bcast_remove, + .auto_connect = false, + .experimental = true, +}; + static unsigned int bap_id = 0; static int bap_init(void) @@ -1911,6 +2167,10 @@ static int bap_init(void) if (err) return err; + err = btd_profile_register(&bap_bcast_profile); + if (err) + return err; + bap_id = bt_bap_register(bap_attached, bap_detached, NULL); return 0; From patchwork Mon Aug 21 15:51:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudia Draghicescu X-Patchwork-Id: 13359591 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 AC50FEE4996 for ; Mon, 21 Aug 2023 15:51:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232444AbjHUPvu (ORCPT ); Mon, 21 Aug 2023 11:51:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236193AbjHUPvu (ORCPT ); Mon, 21 Aug 2023 11:51:50 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2043.outbound.protection.outlook.com [40.107.22.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10D33F3 for ; Mon, 21 Aug 2023 08:51:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G0pffoNgJJFdOstN2XBQgzfkjjsQ3KkleCyNMqEpaLH4Vf0MGb70jAFD3Dv/5wFLBjmSV1Hf3U0Nlmj4l/6xukKqF2YHC3yhP2aE/t1Fk0coZxE9QWIdCbHh3vbLvFUoUp0oHjWKs4OVVy2y/Qgk+C9Wiu6fKkmRjfdYS1oYC5cfCfaeyS8RTaOF8cuDdNjioLD3MOP2f9TLiC9rUheKgK6cC3N5E7ALL+8w8h0iuJwZgxeeBio9U9eTckez6799W85n5Ji0tv+FyPvHaB26B+33q0J5FHG6+zE19hRFDQ65AE/qLWlcHMO5qGPacu8ofvEgg9dSXp2bQ9j/TxqQmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7He6Dog5FMn1fYWSNp8KmvZpTnrkqJdC40wBPVct2Yc=; b=lt9M6r1NuDGeou1HHf8JjbD4nZgQOpV+Fbyx1bVpbZTKt3digImg3fwGO+hFUyL8bOJhktB4JTVucs1UXewk/Cm4FlxUTMMfbABTUjZvnud2sY5sohx4Hj5GfF1vKcpsNSxxS4M1pE2nwnqls2nHC6hG4QDZcrOCN8qAdpBZnZoW8iQUf2LfCTFRl+xycNaAsSFBg1vTqV//LoVErdxEMMG2ls6crdX5OHN4QI26iB+NB83yH5nlfgZRrb5IHQOdGoIjYNeuE8R2tlOrBjpxFd8KINIcf7ZKU2BtayKnzPPaF9Dj4NslPtyyENdMk7eLYIoe5dc4Q1E5hD9k4u5Sdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7He6Dog5FMn1fYWSNp8KmvZpTnrkqJdC40wBPVct2Yc=; b=l/80wHVF44T6wfnR2xfw500gRpHTCN9WpS8mgFX6H6K6PfA6cOo+iGSjSxC5WLcEUeQHuqjesuSV/unbw6u8gEXDZyzmnthQLKjqzQwZEoUtyrTui72MH9SewM+qdXJ/TgryaFkKoHeH9QkRg+FWhi+gLYwEXdE381tXj6TB4Es= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9151.eurprd04.prod.outlook.com (2603:10a6:150:26::9) by DU2PR04MB9116.eurprd04.prod.outlook.com (2603:10a6:10:2f7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24; Mon, 21 Aug 2023 15:51:40 +0000 Received: from GV1PR04MB9151.eurprd04.prod.outlook.com ([fe80::c2fe:9eef:61ea:36d9]) by GV1PR04MB9151.eurprd04.prod.outlook.com ([fe80::c2fe:9eef:61ea:36d9%7]) with mapi id 15.20.6699.020; Mon, 21 Aug 2023 15:51:39 +0000 From: Claudia Draghicescu To: linux-bluetooth@vger.kernel.org Cc: iulia.tanasescu@nxp.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, Claudia Draghicescu Subject: [PATCH BlueZ v7 3/6] media: Add broadcast sink media endpoint Date: Mon, 21 Aug 2023 18:51:01 +0300 Message-Id: <20230821155104.86954-4-claudia.rosu@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230821155104.86954-1-claudia.rosu@nxp.com> References: <20230821155104.86954-1-claudia.rosu@nxp.com> X-ClientProxiedBy: AM0PR04CA0127.eurprd04.prod.outlook.com (2603:10a6:208:55::32) To GV1PR04MB9151.eurprd04.prod.outlook.com (2603:10a6:150:26::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9151:EE_|DU2PR04MB9116:EE_ X-MS-Office365-Filtering-Correlation-Id: 38155ef2-7ce0-47ec-e308-08dba25e8154 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P6w67hBYoe4ypJ1yk3jMNFPFXXm0BGq1VH+FyeeubGNlFAbCk/TyKHfCRHKMfkuZ7aF6ss/d3idxyqE7M7sCMGQTpPaw9QQhsXBy0x4V1XaFYBesOZgOllE8ToWKZxGsK0AgF4Ndupr8n3hhi9j1+tOLh5dmVrwNugBoCivck3NNqijTvkcjzaho8OXnI4FtbTn/B/swwYByvYUhwIPyiO/iYsJEESBeCQ6/5wn1p/00yhKieUmdS4rPWVjcHEcdiT5A+xcPUrvv69RBCBuzJlZ7DpcCJfkVaz4reTGKepAv80yuFWqdb+0Epd66ZNAv/19I2qlrd/u0y1NnyEyTo3TfLKtGNkYfqEu/kAucN3bwevwk9mvGO2OHY1XGDuVJWfPKX11CS8oaK2yymtm0TreOkNl2gIRoopt0k2JPoZpkRfzFPXtiwSrLSn7Ne8g99r83BKszZhwve5mrjjz8Jg00S6EjUfLAvL/vjGvLVYFzkOWJnpSqOVm6Q5JKxJEYr/PcCkIkgzibTrv+dVFIAfM6JJqAR3FQI/U6sn3e6lZDlzM7LEyk7VfseJTrJN9+Lh4PsgVpfpnK++1AqfxeDnIl1uwTClZd473CqSUwt0bhnFbhVLuIfSjVG4l1Odbg X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV1PR04MB9151.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(366004)(39860400002)(376002)(136003)(396003)(451199024)(186009)(1800799009)(2906002)(52116002)(38350700002)(38100700002)(6506007)(6486002)(83380400001)(5660300002)(26005)(86362001)(8676002)(2616005)(8936002)(4326008)(316002)(66946007)(6512007)(6916009)(66556008)(66476007)(478600001)(6666004)(36756003)(41300700001)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AkhOCUD510ZQ97dHNVCCeHryN3AnAbxa3dzTplHBeAuE/uFcyDrTIC1PnoyqLR5YeaL03wqs5fzUidqeFC1kM/zrriL75AwW7QDTWN4CBdzqxby1GGJ61Dxax+wmGQ5i9wqz8klWjjULItxdcL3FosJ6ARLQ/tBsDMRQuNzEjcYkupNn1bY9zzt0mF0+TL6F0+tEIObpIuq4DRP9qbmLfRnzCY3uBrfHlMGytwmMpaf+1ruB5Udm07jAmKBZbzznqdaA4GzbdKTKnjJe/O80Wd3TatMv0dP5x89mj6nbfEy3JH7viyZSv7if8LawpIiW3J738fYm/JxH2uzIU/UA74XrLfnnueHYQAe2vpnlFt9fhLz2Kwy7Vi/ij//+u4ROg9Orzas20KtbMoAYR8rUkZjCpiOrnc2tOuBA4rG7qlHgK9s5ZfHerraPRkQMVIJLk7ROZ7QTcYgNNivnYjCSMSwQyKdJ22JmwsQIAeADcV5q1p5qcSoDjcS7jmXmuW1TqQ4mksgNlRxxTddRygihqGt6gUX9kn1cWko+SYekTDLeT3pJPK5Q9N2mU9txPh3E0LN72Uo3DrcVHikvorHDxl6r3oS7PJo1MSvJiuiA86/MW8WORMdXQdXIr+YYbF0/At/K1/cQjMrwRCzuH5eeomBjPrkhxf9qeRcggBktFKBuys1iYLiotai2jtrn9Kga7DnwHSvzZ77XLSPj2TqLo4+mg0qaK1sdyqYM+gV7wv1OHD/YOLC3BGgsy20Dyorj5yJwNsO7VUFV4ogx5Wqb7gHO9/vwNizjthDKSkctmXZal3UujpJRVtuXQMzDDRnIgRn+2wYaLFikdwJGYhajzDMyWk8hYYffOXfExagyqvM/CoJ6xPNyumXg2cm0lHBHBmtCOJnKHxJXjExcnCU4KjjWfBViVbb+wX5XBD3w0bGjW2RlKcuxIebwU2umvQM3f6hdq7IMUBW9fsHZiS8weJ8olti8v110a2lrQqk0cXUkwrytEOHbROE7XT8HUR3ZiTRBOVNTAkLJkCNf5iDjPbxsQyGOsQkk9wy//UcV/DJUp+dINmXjfOsizsc2W5iF9yIOYK/Y4KZIxyzW0eeE+/VRjQUMBpXdAYNzNzyoJegPv2d2Ffe+DXVYUrVyVo6exxJsdNgMtNbN5gfE8yCenvqbJvnrVVVbSB24i8C9CDHhVsa+Z11SEVZHgCofLDiwXJcsOVYnu34Uy4AoRcTtE2nGGl4ntrfO6A+Sninnk7oS06qnCROFgvgecuRoamBLlCVzaDwIau8R9itFazbYUNhDj1/ThiN0h0RaB0rY2JpylLXjyserG6I33uooy3aOLM8urpySSBp7jcafwZHwbQ974/o2B/rSEB3Djha96bwdtQTJ5ovQ3kySjTfFg2+BB1qaPT6FbOpfrzWPEluGf+++iO8eL5SamHw7ZvLSDjMJ0+i7SgmiTC0WuwaAFosevC9nqkDB942Wi7zFyLmCxTQhBwYX6iBAfMhOCI6jVtNwrGki7C+kuA76ExbLshBfRHvUmSsx0HTCQdGAxsSp3JaYbaSe+7I3uVleEX98moOyDELAYGjARhn/nvCxlX+b X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 38155ef2-7ce0-47ec-e308-08dba25e8154 X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2023 15:51:38.9060 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Br2O1ZHwklf655TYJmjAwIpjcMb0+BQnMOfGS5SrvzP98aohgjynDcNl9SMiWR7+tpbap98ZuyOjTLPZY07e9g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9116 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This patch adds the possibility to register a broadcast media endpoint if the controller has support for ISO Sync Receiver. --- profiles/audio/media.c | 42 +++++++++++++++++++++++++++++++++++++----- profiles/audio/media.h | 3 ++- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/profiles/audio/media.c b/profiles/audio/media.c index 15c64c8d6..66f512e00 100644 --- a/profiles/audio/media.c +++ b/profiles/audio/media.c @@ -1058,17 +1058,21 @@ static struct media_transport *pac_bcast_config(struct bt_bap_stream *stream, struct media_endpoint *endpoint) { struct bt_bap *bap = bt_bap_stream_get_session(stream); - struct btd_adapter *adapter = bt_bap_get_user_data(bap); + struct btd_adapter *adapter = endpoint->adapter->btd_adapter; + struct btd_device *device; const char *path; - if (!adapter) { - error("Unable to find adapter"); + if (!adapter) return NULL; - } + + if (!strcmp(endpoint->uuid, BCAA_SERVICE_UUID)) + device = NULL; + else + device = btd_service_get_device(bt_bap_get_user_data(bap)); path = bt_bap_stream_get_user_data(stream); - return media_transport_create(NULL, path, cfg->iov_base, cfg->iov_len, + return media_transport_create(device, path, cfg->iov_base, cfg->iov_len, endpoint, stream); } @@ -1238,6 +1242,12 @@ static bool endpoint_init_broadcast_source(struct media_endpoint *endpoint, return endpoint_init_pac(endpoint, BT_BAP_BCAST_SOURCE, err); } +static bool endpoint_init_broadcast_sink(struct media_endpoint *endpoint, + int *err) +{ + return endpoint_init_pac(endpoint, BT_BAP_BCAST_SINK, err); +} + static bool endpoint_properties_exists(const char *uuid, struct btd_device *dev, void *user_data) @@ -1351,6 +1361,17 @@ static bool experimental_broadcaster_ep_supported(struct btd_adapter *adapter) return g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL; } +static bool experimental_bcast_sink_ep_supported(struct btd_adapter *adapter) +{ + if (!btd_adapter_has_exp_feature(adapter, EXP_FEAT_ISO_SOCKET)) + return false; + + if (!btd_adapter_has_settings(adapter, MGMT_SETTING_ISO_SYNC_RECEIVER)) + return false; + + return g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL; +} + static struct media_endpoint_init { const char *uuid; bool (*func)(struct media_endpoint *endpoint, int *err); @@ -1366,6 +1387,8 @@ static struct media_endpoint_init { experimental_endpoint_supported }, { BCAA_SERVICE_UUID, endpoint_init_broadcast_source, experimental_broadcaster_ep_supported }, + { BAA_SERVICE_UUID, endpoint_init_broadcast_sink, + experimental_bcast_sink_ep_supported }, }; static struct media_endpoint * @@ -3245,3 +3268,12 @@ struct btd_adapter *media_endpoint_get_btd_adapter( { return endpoint->adapter->btd_adapter; } + +bool media_endpoint_is_broadcast(struct media_endpoint *endpoint) +{ + if (!strcmp(endpoint->uuid, BCAA_SERVICE_UUID) + || !strcmp(endpoint->uuid, BAA_SERVICE_UUID)) + return true; + + return false; +} diff --git a/profiles/audio/media.h b/profiles/audio/media.h index 1de84a8ff..0eeb5746a 100644 --- a/profiles/audio/media.h +++ b/profiles/audio/media.h @@ -22,5 +22,6 @@ const char *media_endpoint_get_uuid(struct media_endpoint *endpoint); uint8_t media_endpoint_get_codec(struct media_endpoint *endpoint); struct btd_adapter *media_endpoint_get_btd_adapter( struct media_endpoint *endpoint); - +bool media_endpoint_is_broadcast( + struct media_endpoint *endpoint); int8_t media_player_get_device_volume(struct btd_device *device); From patchwork Mon Aug 21 15:51:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudia Draghicescu X-Patchwork-Id: 13359592 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 B0923EE4996 for ; Mon, 21 Aug 2023 15:51:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236486AbjHUPvz (ORCPT ); Mon, 21 Aug 2023 11:51:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236193AbjHUPvy (ORCPT ); Mon, 21 Aug 2023 11:51:54 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2043.outbound.protection.outlook.com [40.107.22.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE432101 for ; Mon, 21 Aug 2023 08:51:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YToZ3GlEcsTrbREPZhgCco+Y/tFEy+bsV6L33hXbq7LLUlw8fYmfb7REDv8j/nwKIru+GRJGnWhnTpZoA5HHHOzZu5PRWkKLvdhhN8XI5W3PICGvIACdmMKq1FAfd8etquZA9wQoszsFOFQzrsCCXRO9vbda7xo6P4mARdrBAEGgUYvagNfuKTzRkVNiOYtL9IXDJ9NUP+SsskOckbf3nkcm2yL6sFebzKh63ioocWdjJrk9eT8pZK1JD76ds81Ptx9beoywwv4msODGbblrbCRGt8KA7DO3t4vMSU/Kg+k8Z+msTUyAFhIVv9G4BS2WujM7BSpK2Ravmmj2E7GTIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tMFMd8wMyUm02AdJT82b26aGPLvtgO1k3opeHrQU/b4=; b=Xus47GwSL/HErPKbIY2Dpo05LjmMWEf1mM3VxrqAZ1WybQ0317geqZMRke3P4ghoMVtg5CmQO56aKZuT2OiVYZehdP6Blc9rhW4d/ZPOGYfOEL5KuYiRUprRdFPr6wItPe39gYmtK+Zia3zk8sgNUQ6dNVbMEmQBsGcZ/HzIlY529vN6DHXTxmlLWn9OGlbRyo9Sjg6SK8BNLDyqEV3pY+AR4RWoLrwtreMZAvmT+hbHB1YwhdbFt3J2k3S+ALGL5nvVus7+isLCd6WOW5L5i/JgRNqzDdJY+ep6JQdZxMYndwheANy/eTbW5jakzZ4M1djgEj0W5dqrVrsAJ+t6IQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tMFMd8wMyUm02AdJT82b26aGPLvtgO1k3opeHrQU/b4=; b=DZkyOg92Xc11rNXN0pRwDpJET1p3AYlqpv79ss9y9mF+XT5wGdH/oYmnhccUGd0/8gH7EwNL9eXmcUqLMlgL+zZq+4DKc8uGX9VUm3F5Ti6J4P4qyb8sbxDl3NDHR7uAd01PofewuRNhyeJLnRc4bf/RY5HWSRCpHbbFDeVfCGg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9151.eurprd04.prod.outlook.com (2603:10a6:150:26::9) by DU2PR04MB9116.eurprd04.prod.outlook.com (2603:10a6:10:2f7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24; Mon, 21 Aug 2023 15:51:41 +0000 Received: from GV1PR04MB9151.eurprd04.prod.outlook.com ([fe80::c2fe:9eef:61ea:36d9]) by GV1PR04MB9151.eurprd04.prod.outlook.com ([fe80::c2fe:9eef:61ea:36d9%7]) with mapi id 15.20.6699.020; Mon, 21 Aug 2023 15:51:41 +0000 From: Claudia Draghicescu To: linux-bluetooth@vger.kernel.org Cc: iulia.tanasescu@nxp.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, Claudia Draghicescu Subject: [PATCH BlueZ v7 4/6] transport: Update transport properties for a broadcast stream Date: Mon, 21 Aug 2023 18:51:02 +0300 Message-Id: <20230821155104.86954-5-claudia.rosu@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230821155104.86954-1-claudia.rosu@nxp.com> References: <20230821155104.86954-1-claudia.rosu@nxp.com> X-ClientProxiedBy: AM0PR04CA0127.eurprd04.prod.outlook.com (2603:10a6:208:55::32) To GV1PR04MB9151.eurprd04.prod.outlook.com (2603:10a6:150:26::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9151:EE_|DU2PR04MB9116:EE_ X-MS-Office365-Filtering-Correlation-Id: 3f25d55d-46fa-4807-938c-08dba25e82ff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LXBN8V77JU7kEZvjKn/OCC/OpHxVq54h/KCYKS2qcSaZi51S07as3xaRz9g2m/+8lOjHC5vFL3B0LZFh+tHeLCT8a4z7CAh5YM/oST9x0sq3EJ/xHS7E48ek7y+qnjKFkZz1CFuOO25GZ7LIdvi265RNhaeMYNXE0nE+wlfIhmKJ0MDsYD9SqjDTSE7mUU9IlYQXvwaqUYIqbJ6unHs0ggdzyQztdV1bZ9OYYskOSxmuYswoA6pQpCrWJMWUg2GJYAU7Um2NsyxG2EUirkwyP6zjsVIZLXP3xW6+MxV1HSW4fBtILEUIPfo14b74AMpy9ZoJqmm6sj86mSTTUcgOvfhS/6DtVCCdvy6X1bw2FNGErmUtsgq/KHaa8HK6TcAIbNI+8Ue9UN7Sklgeq09rKHL386dyXnmVXWpF8H9ZX3R9eOsgXdxKwwP/xni+RIvFZPOtH2akbKvn+NbaZeZvmzbaCkm0G8o/lhhTqK+gexhV7mayEbWQD3sW96FfnPnI4laVjZB7y3LcvdfBEyKrywgk/0PybZNyJ2vwzfTbUOJhRDaG8S/PbryHWa4Iy2so2cryw4lpzp0F5z2hXM3y18wI+4Vil403TmktTnftgRytdBybwJMqpQizjnDkYz7p X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV1PR04MB9151.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(366004)(39860400002)(376002)(136003)(396003)(451199024)(186009)(1800799009)(2906002)(30864003)(52116002)(38350700002)(38100700002)(6506007)(6486002)(83380400001)(5660300002)(26005)(86362001)(8676002)(2616005)(8936002)(4326008)(316002)(66946007)(6512007)(6916009)(66556008)(66476007)(478600001)(6666004)(36756003)(41300700001)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SpRVr3biroxiytUn+Y+rwAJJSPty+kt0DJ0wVsq/4IVuYpagYbhs8ndUB5RBnGulAOAtvEQVQf0dtdM+nHV4ozuAYF9uoks25VbJBIF/a3XDuzVMHrpFDleYQaO3+63xsaitooP74+hPmkso6f4T0L1H0A3gWs4kdlRy3WeyL4qyRJpsKfg93NiOAEdd4FQYXPeU/LRpg6SDLnZp1kdTd6FvAfAG4Vw/ecsPnxbFS2eyoK/jciB6mgoJzhu1sQ8qC9y+OrjYBMzjY8CAxc59Rn4cuqC3ITX5xK/JrZv6LMeDl+/EPTz+0HSMBcs9BK/kXzgcIeNjyPjVeuAidLQEg+St42Q7vlcyUpNjIi1Otzcw0WcY7vsCVfKUMe7iOz6Sww0T5UdK1NYOnQmOHrzfwcjQXiF146b7H7YHiir2IEKQo1ZzCm34GxO4drYyIOTnlWkk6uqY8SWrT/i8L9r4w54QOzCltBx0UgXwIJj9bwkhMOn7Ljwn2mWRXfewKjzm1uEWSePpMoty3DbGy0URnDj9UxSAq+0p6gZAB0bgzkCyxW+xI2ndSXZnCIALk4vkMd8t9NXCg5mYRmxyAFJu5JowRtnQEruBViCNrCmSX/5CAwEBEkGWp4nKbTRsMwhAEjcGKAZfzUjWJ4z9qyOcOpS0RJWLvRvY6cg8R3xg8aoFZ+ApKYpX1N0/wmcEi6pdnijxOeLC0ZepL/pBHTwzH33JAjXoqAWrQ5vPK4GCM5B28AafXPejbpbLqUaBYf2OWI8/v37loEnbSU1Bsc0mqq+44KllJTn92TegC41WcHPpQBdI2+INqoenJr1bbvcSuzsuUVJxj0gFYsh5mgywCruKJ4IcGqRiDIA7++FeU1bFpSkutRY6jkbfk4bdW6cFOtZQxqZG8ZK0g9k53HM6bX+6CWtTmB2PCEpYTh/Gl6y3a0Qhj2Jhd7hzyW/ph+Pl0bplR3s19rfjsAb5IkyyId8EXisQGbiY0J8DIs7tdNRGLF0ScnT/REKU56fAMEFz6mD7CnEs++gYoKniyZL3MlgHHqAZZfUAN+QhfRS8j6o3FSc9zX2hhSZ0skLw664zzu8A+ghwadVd5cO5lIiMumehEjP4gLRcZeqA5gB2Fk4tIdJXleLbHT01DCG09i8wLnR1neQnXr2EP4jP7tb+xViU335XTB1zYnAVMO+gzlGSAdOVtlDLjldHSTNri+MpFssyez8i2UpGidLWB++IwZQxKkXbGrfepnhtY1zp8UGIDkWybHHn5Qjplr3loMxydRyU9U0sVYmjyhJzxuPAIz4su955amz3onKAgiSUIQeQnOFpxZz2Rj21/clwbWvfjycVUxA/9Xl6u+R6eGXaj6lpCasR3SC8XfgdEuIL8DHwb9SfIH277z8Ehxhy9G7OVq7u9+EES1FqJgwzOBX+VDz1vxWbff4tQzmrmT40uP2WBgHV1fBaKfmhs1kCqYDVy9mlGnjfq6oaGWEaQ5xyqEgRYvPIaK8KHuvNuTTZWO249Hxq2fW3Ook2xs8Ir72iNyn71w4cnUZQ3O/1pUZ7GKxGuW72OhMALF1fYTrDHBrRifqImDIWYN6KLpA9/wxD X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f25d55d-46fa-4807-938c-08dba25e82ff X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2023 15:51:41.3967 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: igQzmmNOT0k/m2TFSJxDXZ4BBGXldxUid0jJ9MBIev1aSVMoo5Prewxqbq4wWwuG1CMAuG2/Qd1/Uur/f0M2FQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9116 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This patch gets the QOS broadcast stream parameters and passes them to upper layers. --- profiles/audio/transport.c | 251 ++++++++++++++++++++++++++++++++++++- 1 file changed, 249 insertions(+), 2 deletions(-) diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c index cf5662d1d..f7a29ca83 100644 --- a/profiles/audio/transport.c +++ b/profiles/audio/transport.c @@ -552,6 +552,8 @@ static DBusMessage *acquire(DBusConnection *conn, DBusMessage *msg, owner = media_owner_create(msg); if (!strcmp(media_endpoint_get_uuid(transport->endpoint), + BAA_SERVICE_UUID) + || !strcmp(media_endpoint_get_uuid(transport->endpoint), BCAA_SERVICE_UUID)) { req = media_request_create(msg, 0x00); media_owner_add(owner, req); @@ -853,6 +855,9 @@ static gboolean qos_exists(const GDBusPropertyTable *property, void *data) struct media_transport *transport = data; struct bap_transport *bap = transport->data; + if (media_endpoint_is_broadcast(transport->endpoint)) + return bap->qos.bcast.io_qos.sdu != 0x00; + return bap->qos.ucast.io_qos.phy != 0x00; } @@ -868,6 +873,18 @@ static gboolean get_cig(const GDBusPropertyTable *property, return TRUE; } +static gboolean get_big(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct media_transport *transport = data; + struct bap_transport *bap = transport->data; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, + &bap->qos.bcast.big); + + return TRUE; +} + static gboolean get_cis(const GDBusPropertyTable *property, DBusMessageIter *iter, void *data) { @@ -880,6 +897,18 @@ static gboolean get_cis(const GDBusPropertyTable *property, return TRUE; } +static gboolean get_bis(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct media_transport *transport = data; + struct bap_transport *bap = transport->data; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, + &bap->qos.bcast.bis); + + return TRUE; +} + static gboolean get_interval(const GDBusPropertyTable *property, DBusMessageIter *iter, void *data) { @@ -899,6 +928,9 @@ static gboolean get_framing(const GDBusPropertyTable *property, struct bap_transport *bap = transport->data; dbus_bool_t val = bap->qos.ucast.framing; + if (media_endpoint_is_broadcast(transport->endpoint)) + val = bap->qos.bcast.framing; + dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &val); return TRUE; @@ -910,6 +942,12 @@ static gboolean get_phy(const GDBusPropertyTable *property, struct media_transport *transport = data; struct bap_transport *bap = transport->data; + if (media_endpoint_is_broadcast(transport->endpoint)) { + dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, + &bap->qos.bcast.io_qos.phy); + return TRUE; + } + dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, &bap->qos.ucast.io_qos.phy); @@ -922,6 +960,12 @@ static gboolean get_sdu(const GDBusPropertyTable *property, struct media_transport *transport = data; struct bap_transport *bap = transport->data; + if (media_endpoint_is_broadcast(transport->endpoint)) { + dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, + &bap->qos.bcast.io_qos.sdu); + return TRUE; + } + dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &bap->qos.ucast.io_qos.sdu); @@ -1040,6 +1084,121 @@ static gboolean get_links(const GDBusPropertyTable *property, return TRUE; } +static gboolean get_sync_interval(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct media_transport *transport = data; + struct bap_transport *bap = transport->data; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, + &bap->qos.bcast.sync_interval); + + return TRUE; +} + +static gboolean get_packing(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct media_transport *transport = data; + struct bap_transport *bap = transport->data; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, + &bap->qos.bcast.packing); + + return TRUE; +} + +static gboolean get_bcode(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct media_transport *transport = data; + struct bap_transport *bap = transport->data; + DBusMessageIter array; + + dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, + DBUS_TYPE_BYTE_AS_STRING, &array); + + if (bap->qos.bcast.bcode && bap->qos.bcast.bcode->iov_len) + dbus_message_iter_append_fixed_array(&array, DBUS_TYPE_BYTE, + &bap->qos.bcast.bcode->iov_base, + bap->qos.bcast.bcode->iov_len); + + dbus_message_iter_close_container(iter, &array); + return TRUE; +} + +static gboolean get_options(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct media_transport *transport = data; + struct bap_transport *bap = transport->data; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, + &bap->qos.bcast.options); + + return TRUE; +} + +static gboolean get_skip(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct media_transport *transport = data; + struct bap_transport *bap = transport->data; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, + &bap->qos.bcast.skip); + + return TRUE; +} + +static gboolean get_sync_timeout(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct media_transport *transport = data; + struct bap_transport *bap = transport->data; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, + &bap->qos.bcast.sync_timeout); + + return TRUE; +} + +static gboolean get_sync_cte_type(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct media_transport *transport = data; + struct bap_transport *bap = transport->data; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, + &bap->qos.bcast.sync_cte_type); + + return TRUE; +} + +static gboolean get_mse(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct media_transport *transport = data; + struct bap_transport *bap = transport->data; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, + &bap->qos.bcast.mse); + + return TRUE; +} + +static gboolean get_timeout(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct media_transport *transport = data; + struct bap_transport *bap = transport->data; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, + &bap->qos.bcast.timeout); + + return TRUE; +} + static const GDBusPropertyTable bap_properties[] = { { "Device", "o", get_device }, { "UUID", "s", get_uuid }, @@ -1059,6 +1218,17 @@ static const GDBusPropertyTable bap_properties[] = { { "Location", "u", get_location }, { "Metadata", "ay", get_metadata }, { "Links", "ao", get_links, NULL, links_exists }, + { "BIG", "y", get_big, NULL, qos_exists }, + { "BIS", "y", get_bis, NULL, qos_exists }, + { "SyncInterval", "y", get_sync_interval, NULL, qos_exists }, + { "Packing", "y", get_packing, NULL, qos_exists }, + { "BCode", "ay", get_bcode, NULL, qos_exists }, + { "Options", "y", get_options, NULL, qos_exists }, + { "Skip", "q", get_skip, NULL, qos_exists }, + { "SyncTimeout", "q", get_sync_timeout, NULL, qos_exists }, + { "SyncCteType", "y", get_sync_cte_type, NULL, qos_exists }, + { "MSE", "y", get_mse, NULL, qos_exists }, + { "Timeout", "q", get_timeout, NULL, qos_exists }, { } }; @@ -1341,6 +1511,77 @@ static gboolean bap_resume_wait_cb(void *data) return FALSE; } +static void bap_update_bcast_qos(const struct media_transport *transport) +{ + struct bap_transport *bap = transport->data; + struct bt_bap_qos *qos; + + qos = bt_bap_stream_get_qos(bap->stream); + + if (!memcmp(qos, &bap->qos, sizeof(struct bt_bap_qos))) + return; + + bap->qos = *qos; + + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, MEDIA_TRANSPORT_INTERFACE, + "BIG"); + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, MEDIA_TRANSPORT_INTERFACE, + "BIS"); + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, MEDIA_TRANSPORT_INTERFACE, + "SyncInterval"); + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, MEDIA_TRANSPORT_INTERFACE, + "Packing"); + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, MEDIA_TRANSPORT_INTERFACE, + "Framing"); + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, MEDIA_TRANSPORT_INTERFACE, + "BCode"); + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, MEDIA_TRANSPORT_INTERFACE, + "Options"); + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, MEDIA_TRANSPORT_INTERFACE, + "Skip"); + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, MEDIA_TRANSPORT_INTERFACE, + "SyncTimeout"); + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, MEDIA_TRANSPORT_INTERFACE, + "SyncCteType"); + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, MEDIA_TRANSPORT_INTERFACE, + "MSE"); + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, MEDIA_TRANSPORT_INTERFACE, + "Timeout"); + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, MEDIA_TRANSPORT_INTERFACE, + "Interval"); + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, MEDIA_TRANSPORT_INTERFACE, + "Latency"); + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, MEDIA_TRANSPORT_INTERFACE, + "PHY"); + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, MEDIA_TRANSPORT_INTERFACE, + "SDU"); + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, MEDIA_TRANSPORT_INTERFACE, + "RTN"); + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, MEDIA_TRANSPORT_INTERFACE, + "Codec"); + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, MEDIA_TRANSPORT_INTERFACE, + "Configuration"); +} + static guint resume_bap(struct media_transport *transport, struct media_owner *owner) { @@ -1493,7 +1734,10 @@ static void bap_state_changed(struct bt_bap_stream *stream, uint8_t old_state, if (owner && owner->pending) return; bap_update_links(transport); - bap_update_qos(transport); + if (!media_endpoint_is_broadcast(transport->endpoint)) + bap_update_qos(transport); + else if (bt_bap_stream_io_dir(stream) != BT_BAP_BCAST_SOURCE) + bap_update_bcast_qos(transport); transport_update_playing(transport, FALSE); return; case BT_BAP_STREAM_STATE_DISABLING: @@ -1503,6 +1747,8 @@ static void bap_state_changed(struct bt_bap_stream *stream, uint8_t old_state, return; break; case BT_BAP_STREAM_STATE_STREAMING: + if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SOURCE) + bap_update_bcast_qos(transport); break; } @@ -1631,7 +1877,8 @@ struct media_transport *media_transport_create(struct btd_device *device, properties = a2dp_properties; } else if (!strcasecmp(uuid, PAC_SINK_UUID) || !strcasecmp(uuid, PAC_SOURCE_UUID) || - !strcasecmp(uuid, BCAA_SERVICE_UUID)) { + !strcasecmp(uuid, BCAA_SERVICE_UUID) || + !strcasecmp(uuid, BAA_SERVICE_UUID)) { if (media_transport_init_bap(transport, stream) < 0) goto fail; properties = bap_properties; From patchwork Mon Aug 21 15:51:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudia Draghicescu X-Patchwork-Id: 13359593 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 CE97DEE49A6 for ; Mon, 21 Aug 2023 15:51:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236488AbjHUPv7 (ORCPT ); Mon, 21 Aug 2023 11:51:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236193AbjHUPv6 (ORCPT ); Mon, 21 Aug 2023 11:51:58 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2043.outbound.protection.outlook.com [40.107.22.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1061FFE for ; Mon, 21 Aug 2023 08:51:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hXaNk6GnMPvsPQwVqUR9szloMxzEfnnw29xY/hUxESn1Af8g5iOgZ9G9sU2JIDijTWf3dzNbfHvq8t1CHJOmd/zvdl4DorisLzQ15aJ7Fydm1PgTewFJtvHQ3bZqGdmPX2NPPowU2nYwm6eCeoBYedFa8K1+1b57Ov6KI600IGyABpDZiX83X9EODEnuwKrAH5Pw93WJvA5MJYIv/iPCdPQu0Pj6DX0OFyxazX//qcsc/sIdPKiGcSv1D+SAo5/upqNlPw332ObnnJqYRGuLT1IfsSypJrvQnNHsj1tEyF8EMCZINHQ8wrBIZw0ahFo1xyylPEXXu9p9xswkdT9kDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SiF1ouM49xxIFi/dIK76vtBldjOFMJOc7QnnmzBaf2g=; b=Ce6TU6n4LI+yHCFO3z+AofW2hS8YA2+HmuhPKuGZGSDuwrKwDvfVJJCePD3CLG4cdfdC5HQKrV31IUEh8Hx7pwEgGjh/AOIYAePiE+s++Zh3wDWTxVqjyaxeBxJQXZ2fTm1rJxIYh/YqSFQ7p7Pgc0w5HabkqoZQg0/QKvZA3I8AeVqaOV6/OplWSceoqQxQPd4SKUfnoV78jw9JbOgVPgr2tu3CWzBPbwsjg8dCqRYhq+ZN0OmY6Dm8Y+PoFCRSymc4OhbvTlPitcs3kLVRoXSidcg27RrLMeNSobifOEZ9syeRKjX2S7LhlzbdwqNfOtTZwntPtJe25W8Sr83/ow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SiF1ouM49xxIFi/dIK76vtBldjOFMJOc7QnnmzBaf2g=; b=ZgAZCScFEXk3RIFzUIgRBQDbH9XJiYhgV382jc7tl0TBmi2KSZ+G9lJieOdxxLJS0DC7jkhF1njx1h8LX53M1FCbON5zFukYChDxUKACELgesy3xPNdnPefwz95dlRO2yksxGZ1hQZ3D4iNbASpJOfAEdC5AwkdfJb/Y7x3zbXk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9151.eurprd04.prod.outlook.com (2603:10a6:150:26::9) by DU2PR04MB9116.eurprd04.prod.outlook.com (2603:10a6:10:2f7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24; Mon, 21 Aug 2023 15:51:43 +0000 Received: from GV1PR04MB9151.eurprd04.prod.outlook.com ([fe80::c2fe:9eef:61ea:36d9]) by GV1PR04MB9151.eurprd04.prod.outlook.com ([fe80::c2fe:9eef:61ea:36d9%7]) with mapi id 15.20.6699.020; Mon, 21 Aug 2023 15:51:43 +0000 From: Claudia Draghicescu To: linux-bluetooth@vger.kernel.org Cc: iulia.tanasescu@nxp.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, Claudia Draghicescu Subject: [PATCH BlueZ v7 5/6] client/player: Remove Broadcast parameter Date: Mon, 21 Aug 2023 18:51:03 +0300 Message-Id: <20230821155104.86954-6-claudia.rosu@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230821155104.86954-1-claudia.rosu@nxp.com> References: <20230821155104.86954-1-claudia.rosu@nxp.com> X-ClientProxiedBy: AM0PR04CA0127.eurprd04.prod.outlook.com (2603:10a6:208:55::32) To GV1PR04MB9151.eurprd04.prod.outlook.com (2603:10a6:150:26::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9151:EE_|DU2PR04MB9116:EE_ X-MS-Office365-Filtering-Correlation-Id: e12d187e-2ea2-4667-e79c-08dba25e8469 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GyyZfxR33xKoGwurVl1wuFmwupvh5dBC+B1cYOMQB7gwitYjytg3Vq0leTYS6YQkoyfrwhkg/A9aeY0EeeusTzVVnTD7S+bLVn/RhzoTCqbeRrIO8OUKbvY4IVLTkFa+gA87u+95cpCCWqQu65x3pTvkC3Yje+M/gwd2hErYwNCsfljPAbwmr0mtWzkYMRYkiJmNHlFJt6iZtmfU0NZ+0JyMq2TQoUpfboNzTRdYNmKzM4bJg/2KPK6sgYqyICSmD/RCMJyXmndAaSmAvo0Ivmy45JSTMbevlW6+X53a4Sg0F6mhTgCUPNp5XuWE5wT2UUyK684B0Ink+QRoFloM9T17j+S/9aR0vW6ODpqiLSms2ilSCLyXHMwoezp4imonFv5maDOPDtsZV5Pje8jHNEgsIn9+rrGUf1l69T8+9p/J1vksvxEvHXuP2xzie7cux5iRgyeW9Ng/IX8c1j6/HcOPlJGueIAYthkrbntqHFw7GxjJc2OeQgswzAWi5sfDWc7OtUdgjs1NFmbNjqojXa40bblQIew5UzwxBSU3zdrYjsM+HLFTMljPQS+G3X9G6x2SDRtfNjBiZ8cYI1hZlGm0Xe7xAyrxQ9fVyLRNVrcGafrgmiDvhjFKqrcUITLF X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV1PR04MB9151.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(366004)(39860400002)(376002)(136003)(396003)(451199024)(186009)(1800799009)(2906002)(4744005)(52116002)(38350700002)(38100700002)(6506007)(6486002)(83380400001)(5660300002)(26005)(86362001)(8676002)(2616005)(8936002)(4326008)(316002)(66946007)(6512007)(6916009)(66556008)(66476007)(478600001)(6666004)(36756003)(41300700001)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GROOW9wbzmLatb8CBI0FaSMbqW4iO+dWzko6RQjQqBJZTj4eX8T0pa0o5f/OHBN3XQqlhiB9QoJm7rGNmabLgDA4aGdQviKzi5IE+qFRIgDnHmpo7LVMHpxJQwZkS9lJEGWaHgnaD1wodgw/pT4mUxLg9IYR9khGCkXLWR9bgGFJHbbHPX+ndW367Mfo+NNs2fvIdimdFeQL1wB14ybmliX7id9tvmhCZmSSTq1GxHljhIbcTJ8pMyrDxCmMqNMzBPiAVeD+RVq1V2UWNNFOjPpRpnvHKiu4tYvPKK9vcSMRb3W7d6/ToSEfi+6Bx/rFJhY9NoPzEZFKXwuBYGvChdH4EmCemz02OEZvLKKqtUy2cvw9rW7Y7KB2p5/SgSACLJyT33HPE+/DoTXbDn045pgcD7nVaX7AQ3G5rQYwUcfq7GgWibyfnzqHxNCjpJDwXGAIj0gvR4imweOcbNpkr8OKRmONOtfKMIGCRZJs3Xo8BdoBPyuOkpkJsrxuyDU2A4+tHr6CNUMcaYn0jN9H1VgW2B2EC2JwP3EUkwTKJPAeSAwVAinS4bsGeutkRP0ysbKlDXAgYhxGELPzdfOQf6bFnOWjkNn2iQuJu8ENO2uwO6vGdyqVmtFodPyM55S2SsWzgXZJ791NnaYyTOymFIVdGwcVnRHiSTx2akxzGEkSAmTY2gEBFEZ5qRTUuAZGdqmfcyunWojf6n45GGDGSH9Bit7b3Jayd6bSTj5P2D1WE+/FryTm/Q13gzZY+IS6PgIqwIxrTOJHWXNIgFU1KA1fKJQSi0z6mSw/MzRoKPe1Rv9EwFmqrD4FyDhkrwGfEIfGi4pxxxG8xcZn3yxqrDRt/N2/qKc26TjHzcw52j4mpwgeEsFQ0QRXsASndGOhnsXtQsEQb4sgoO7EIruxC9Qt0IBKEUurKfcp40c6n3xPlUrP8fwuvkub+3k7C7yzzk9svIYcPw7+Nz8fGj7crpB5PxVTDFFrWHJHy6OcgDqTXxTQT2Fv+xN6KrAHfZPAlzFhHlIa9cUCT/mhoEbZ1hpRSjvmwv8WCdC4GQIEWdv/NFnn5CW3CzTbGZ/qHfXKnpiQ+6PhhAdW9jE8E13+e83tZsj5de06csTS+EszYujzyrfdWrTwBygYTuInOq83nRWhtyaIZGSfywrPEd5ww30e+k12JyTkl3bgaO3q74cNorpecNtboVm/fhzZg3zmI7HpxDCGXLop7g8uwLW/xjK5mZlNMrVgOFQxqSGEkQ70JuUVjZkyUga5fCv7fwdTzPi1nWpcWU4IJEnIvyT+ASDENQY31oDyWwem7MVHJ8ZyrUjdeYdwgXD/QtdH6VL7LB4C3zfxpyMFrDBcYQId6kxHMwinijkkhTTuBUvDe1OLBN7n3McWuw+QEP3Ju3P8SjGtPbwEQXH1SpqwsuEndeDWU4VwPBPsim3+4P3s61YSuLShEIxuKDGAIGkbMy8J/5JbuwqxPIp7vtTQm//Aq9/O9NohYnxgblipjZT7EDNW/KqkOPxk6OfPoJxEP8LQXcDhZDFMhlSxhvBTbeuUavp0SZhBaXA3isSYnEqNO0XD1H3Q0odpeB943XDiKc7cg1mq36P2WcxMXbibYpLxjQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e12d187e-2ea2-4667-e79c-08dba25e8469 X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2023 15:51:43.7335 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: w1i0jB7pfvEHbD1d2956eh46oEAKs5vPFj33vckIurROugAsi6uaUI2ZwebIjrkIN3w//OC+g8ZEDQrd6UFihg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9116 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Remove unused gdbus parameter. --- client/player.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/client/player.c b/client/player.c index 3611a8dfe..38590405d 100644 --- a/client/player.c +++ b/client/player.c @@ -2297,9 +2297,6 @@ static void register_endpoint_setup(DBusMessageIter *iter, void *user_data) bt_shell_hexdump(ep->meta->iov_base, ep->meta->iov_len); } - g_dbus_dict_append_entry(&dict, "Broadcast", DBUS_TYPE_BOOLEAN, - &ep->broadcast); - dbus_message_iter_close_container(iter, &dict); } From patchwork Mon Aug 21 15:51:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudia Draghicescu X-Patchwork-Id: 13359594 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 3EE5DEE49A6 for ; Mon, 21 Aug 2023 15:52:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236489AbjHUPwD (ORCPT ); Mon, 21 Aug 2023 11:52:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236193AbjHUPwC (ORCPT ); Mon, 21 Aug 2023 11:52:02 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2043.outbound.protection.outlook.com [40.107.22.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE672F1 for ; Mon, 21 Aug 2023 08:51:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rz+oGoSecN/KFcn6vy/yC76nmAWeCKGjorV+KYwEEHF1+BMUG5Xie4cLDZhL0Et7gwfoDLG0gzKEFcDpiMvxTXdv+SYHE2Iuf7W8ToLRVIHZXyEzc9B1FKYaeR/R3dTS08rX0Yx8Zv36lPoQYt18mstPrY+35x3nVvl1+Yq0qc51LrisSfjEc3H2x1lRjQGA49CKGmmwOsztYYJgwRFEGxvFoiz4Vm/u1yAoof5N9QK3YNSHjkgtdIbqRUJcRHyA5zW8sLb69gqLn2+kpYNpe7QZJr/xjP7UBNpN6XV3SsGnsHhmUiNtub+QB2w3+BeYGoU5jlLYolggoXsf2hqjWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kqjJ2ajp34cp4Rrzia79nTVqyNroqrDQQkYBHZpCfcI=; b=Lx8T+UdEfCs7J2EhiAFsFNlS3WFj1DMiUhw86Ogu4M7c3Rpepf3xs2OyHmabPR6rdGTkmDaHr6+t3VlkptXsEoyyei9O4mIl21dM6umDRalhyJbUhUwuJlg1NDdvQ/ezzyPkVsuq3gDnXuCloUdLdODVZ3FvyM68CXSCdVGNDL0Q/fUjudqQW4zFyuNGD2ikWGjS34rOh3EniskXW+8ecN56346ypxC1QomUaV3A5zTTAW/oZzjORrgNyElgDEB2e3ep2V/Pr+z8pXzs7+OwkFEMHbtY6zNJr/0HIQbtOWjq+DcfVfikg9qlyzIJvbxSdR+MXJZ5+cVRf6bLysW2xQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kqjJ2ajp34cp4Rrzia79nTVqyNroqrDQQkYBHZpCfcI=; b=j0v3rLvL6udbo8qvaNELF7yXiU124ALH07GDI7C8SOzFp5Jxu9VSL8dVGWI8DifUq2NmEJxaGKqR04olyjXju6LiZnOq02mNyk5WejRq4OJ/DtY1S+ON8LsxED3h+eOG3rQscJl6vdsBnHHp2FJ18E5OEHlCNisYWCY8xbvQ17M= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9151.eurprd04.prod.outlook.com (2603:10a6:150:26::9) by DU2PR04MB9116.eurprd04.prod.outlook.com (2603:10a6:10:2f7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24; Mon, 21 Aug 2023 15:51:46 +0000 Received: from GV1PR04MB9151.eurprd04.prod.outlook.com ([fe80::c2fe:9eef:61ea:36d9]) by GV1PR04MB9151.eurprd04.prod.outlook.com ([fe80::c2fe:9eef:61ea:36d9%7]) with mapi id 15.20.6699.020; Mon, 21 Aug 2023 15:51:46 +0000 From: Claudia Draghicescu To: linux-bluetooth@vger.kernel.org Cc: iulia.tanasescu@nxp.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, Claudia Draghicescu Subject: [PATCH BlueZ v7 6/6] adapter: Fix UUID name advertised for bcast source Date: Mon, 21 Aug 2023 18:51:04 +0300 Message-Id: <20230821155104.86954-7-claudia.rosu@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230821155104.86954-1-claudia.rosu@nxp.com> References: <20230821155104.86954-1-claudia.rosu@nxp.com> X-ClientProxiedBy: AM0PR04CA0127.eurprd04.prod.outlook.com (2603:10a6:208:55::32) To GV1PR04MB9151.eurprd04.prod.outlook.com (2603:10a6:150:26::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9151:EE_|DU2PR04MB9116:EE_ X-MS-Office365-Filtering-Correlation-Id: cfbef80a-4d95-4745-7a26-08dba25e85b0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M0WB21GJeZT2PSqA9v0190+cf+fznQ5ZMCXN7sexikqiiOwDKdECVUhZvGoUu96Eik38ttJWK0TSn2lQHvEpV4i/cF4GnH6pYKnUqF5kmw9epDp5r8GJFj8fxlHrOp8hVIDhU3frstT8uPPcruGmbKC4cuZjtuuVIj/dKS2aBKcEDAkM9yz6D8q62MKp6LJgnnbDbLNFfcOAYumueqSEe6CIuVJbEcdptfHAcNZW7/CTQ3rHIuEt1MWaW9aTub5OJ5ODC/gabVcA09YjXGg+JG7rxQXDp9vdhvLqi+ICvsh8zyo44wRKYk4MUt6GCo+ngvj6lQqcIVaCZT6WN1CmRWxZSKj4CEVS8IX1rFBvhQFuUW9p7kMD23lfPsb21imWNoazLtYdVVNl9HuT+DgO7i7n6795JD9au/YZJNmC8EOGktvPREZPeQcHoS57vxKLpgKAsXvWyJ3fVlg7abypKU1zdChy6tXmfd+zhvkKqB8D+HZd0aVqE5rgrEQFDZUXML3/pFW4hqBdgXLjX2O6//07/Lv0/w0MM9y94kGGp+DblJXYUDJTgFtXbRMvGYcPRyhQXEY8IwXtXoDcbcZc9f17LZHF1kR7aGSkqPqutnoJwaGYQzUewUjt6Ou9dxOc X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV1PR04MB9151.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(366004)(39860400002)(376002)(136003)(396003)(451199024)(186009)(1800799009)(2906002)(4744005)(52116002)(38350700002)(38100700002)(6506007)(6486002)(83380400001)(5660300002)(26005)(86362001)(8676002)(2616005)(8936002)(4326008)(316002)(66946007)(6512007)(6916009)(66556008)(66476007)(478600001)(6666004)(36756003)(41300700001)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 01e9U7Hq999lFnWvIlRQjgJS2Nbn6aPic+/vc3RgjJp5+7CZiJljv9ZPbgEFwP50Sg/fCRzPhKFlJ5iwIxWUTl1Wsyq4FW7fEyyS4ZJrVD2O/WiXSewPF4eRxR8TOSNl+tm03V5HWiRhQjAAhAytBh7nTzcI/aRdfgsnhM/Qe5AZxXTdqqFz0BRjYBzBx9h2dO5gBWCCx3TN8mL5zwp7e5IJL915V4loj7Jvu9fggE1W5fnnyRpknS8AjOG7BHtC1CGz/x+eXjgAtDITMscdoptSKxnb9J2g6AbPc+CqrEv7ntXIQf0Web2+0qCXX4hJYKkXioIYESGvaUlaFXDcBW4G+G31mEbA7EvaIaiQrGRXPg913AnF0RhLPY0txI25lKcbJJ0PYBT8NyARg85n9BsEUULIxt3xsrsUFerv9WjOaWXqlRlK4bxslrNYeNy/0iJW3I2QYWRsM0wMeWXCAic6ElLynysfwYLVJ5f9k85D7Lo/szsZiwqnwGWnRrwwHDjx3pRSZxa3IVnFe+IR5fMAhhpT+dkHRcGC8EZLGEXx5sWRx5aBD3AhoX2g5FJHoVJCSqTn6XY/Yr9Zt1Ya1l/plETd4rq20sn1RDPLmCy7P/dTsqT93EpxyvLMMLpHbNOfPGLRfqT5wRyhoynTAVAjzXzHQoQydA+3MmCy/tD+BjT4+HZnj8mp6qi42q5aZcavXDPOTEtA6vqmo5t7X3rGGLIJIpn+2SN6C/na4p7vCsCspIFcz4wX3C+CsZI6vZQFO5SSakKMB68IyoweysOpRoK+ZpX6xjDAcDLJ4GANvYaAN8tcFFgCaXPgHTXlLgJEyNUFM/YtLLnbE2+8TwmPF2wix23bQePJEEoVrMUvdm1LXlzZp0d0jHMVh6Y9lzmvLfWr+bOKyx4ZkaDywxLE21JKqt7ueZddNG4WFAJlOqTzNBR3pCNYOuaAAHAIq2knvZ31VsjyFFCl3gLPtDleFOd6m+f2+843OkTH+F+ZpZom+qujUi4XrCQ0eb39EpPcgAHLJTXH27i/U5Ry54lYiiHR+p3VqId8lPhBKgonB17QCSDlI0onLHpn6sv2ShWzKXE7uwmnR7afJie7uhkcdHIna7dG4ro0NCRhKMWy7gfqreRsdFOWVP4fSPJT42knSXFaPFlKhd++hYGzTWff/HOI+a11tuS587CXx0kEEfAM2IEERkkFspUB1w+DXc0J5s3tcdc9ko+SH/yxuJJiMDvnym4mi3Y9t+WzCgEz5+/3JEoXcoS6/qkvgCzOO6A9pKhBbDuOs5EvaSzXQz05a5CzJF8OU9Y9rfrZkp9IK2634l+c7SPvDfHmR7iH8kmqBmsQESCmjqV0QcGqzms8m3d4PzQeyNBWZUOT0fUAfkTR2k4Hjlx+k5uO6rm2BiAvUOt5oIiUe9Il/1yGGb79fjk5a+RfvA8rrkBlZb+RH5T4Ky+jpRldLH6Kl27MxnJZWoj1Q0lT1WamsjrSHzb3I0Kz/cDc0sjM5NuW/VXCM3ctAItVn+kdJAzSshoTqJZi8tlqUHEYICt9YL3ZJZwGR9SfH6fgdU9NEJrrrrAQn+/C7v3IjozqMfdawg6pWdfhbX2upxUAQpXxysjvhQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cfbef80a-4d95-4745-7a26-08dba25e85b0 X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2023 15:51:45.8595 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AZQOFQYLrW6FO5OiKq56NbHJDTbfEi3qQTs/bICaCUYdgwuSv8JlcmwTbAXoxYZZUisVmb9RXxceT/fGAlZ7IQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9116 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Fix UUID name typo. --- src/adapter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adapter.c b/src/adapter.c index 004062e7c..f2f53d339 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -7155,7 +7155,7 @@ void btd_adapter_device_found(struct btd_adapter *adapter, /* Monitor Devices advertising Broadcast Announcements if the * adapter is capable of synchronizing to it. */ - if (eir_get_service_data(&eir_data, BAA_SERVICE_UUID) && + if (eir_get_service_data(&eir_data, BCAA_SERVICE_UUID) && btd_adapter_has_settings(adapter, MGMT_SETTING_ISO_SYNC_RECEIVER)) monitoring = true;