From patchwork Tue Aug 22 14:29:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudia Draghicescu X-Patchwork-Id: 716629 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 94459EE4993 for ; Tue, 22 Aug 2023 14:32:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236782AbjHVOcl (ORCPT ); Tue, 22 Aug 2023 10:32:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236788AbjHVOcg (ORCPT ); Tue, 22 Aug 2023 10:32:36 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2066.outbound.protection.outlook.com [40.107.6.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F397F3 for ; Tue, 22 Aug 2023 07:32:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PD9AzTgN4xWHSW0/xsvQ7lRj3wKengXMMjx2zK2VVvTCUzGjvPcF1WJErBpPpn2ZKFz98UbscJm966LFPEgCGy6WqjWuFAPjCoq5Fl+IBDwFUhZ0gWlDlEw7KX4F8YQBPbN9fFdGP6Cy7uhGuXhGCt4YKCUXmH22RaF1XgMS9GyWVZ8GtdjUmtjTjGvXrNsP1fFWWoMiK7q/uKXqblvAPIMQISqJRTj9dsi8wDBsUK44Q5c5qmITU2nJ+p6IV6glr4JyD+sDftGJouCoYPS6ItU8dNMgu4QH2svOS4pEfJcZNhdtg+/B7GgHSvcUTKHmcxXbD8sBOrmHb4zPTDaeKg== 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=K1BKn2AJtHWg2SxweNXPXyyWKUHZ1NMmVxu7wrXNzJM=; b=T3JScYgH/VHT3sPHx7lliqXsuK127sgr4XSEathr7EH6kCqakQW0pDjpN1bwRqxxBxazagd2Zmpvkt6y/R6oPpTikdTyhT0AtEFU7rkurdmrUkXi5DwXLnTpkOm+8WHSwhTlQrihR9G8FmKaiLRg/6BW/RuHFRreLdhAtIuIvt3Wr6WxjVWTiARv4xV+zK1bcV5Vkk2ebY2GDpiIlm1eNjBCQiCDl34Lw6IvbF3XvQJyo7ZfAktuZBWpQIZ/qf9CWPNirLk4W7+Ui6dqY5WvULbV1shXJc7LqhTbF24sOgI3vUix4kAnX/sOBABozVFQTubAVEmtFqw3UG86JyInNA== 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=K1BKn2AJtHWg2SxweNXPXyyWKUHZ1NMmVxu7wrXNzJM=; b=RZ05FuiocwZhe+KiTgjqW07WCyesppowKJJzXwsY7Slf/jf9IPXAb1C+VCQzpqx8ljlCiKr5sEV9w2dqfT8wO6Zbnp6ERA9Bbxn0GhwmETPp1aBDJj9IfSX8hnp1dUw7dYGU01ZGeWYuYuZjnicdWfdoUwOO9KtFFaHTSGHsRjs= 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 AS8PR04MB8707.eurprd04.prod.outlook.com (2603:10a6:20b:42a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24; Tue, 22 Aug 2023 14:31:50 +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; Tue, 22 Aug 2023 14:31:50 +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 v8 1/6] shared/bap: Add support for BAP broadcast sink Date: Tue, 22 Aug 2023 17:29:30 +0300 Message-Id: <20230822142935.6016-2-claudia.rosu@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230822142935.6016-1-claudia.rosu@nxp.com> References: <20230822142935.6016-1-claudia.rosu@nxp.com> X-ClientProxiedBy: AS4P190CA0041.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d1::15) To GV1PR04MB9151.eurprd04.prod.outlook.com (2603:10a6:150:26::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9151:EE_|AS8PR04MB8707:EE_ X-MS-Office365-Filtering-Correlation-Id: ca3bb737-ad08-4b01-f605-08dba31c85dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Gnsrq8UoTnRQ58B5m36rEPS8aJxWOI35bJYc+CDXbanPNcEO2zCEKVfgXwzR9CKmDRm1Mu6KNXpJ4EL6TOPLFRKURRxWIhtUO8pG4HKv74UjiUWHue1oUwejuTRPC4s5lYlLEmKXiX4SnJD3FlMy/ixF0JQ5QH1sMhA4Hb1kFAgub8sZxKPb/uFx8tF1KRMdeYngPkc7KfFzVT84S9HIiTpnPgWfBC5vkBR9ruy9Wa3dlQMAvMFcSZ9BoMKLZJrz/3LEkF6foIRuN+fA3TEqhFzuFAXMaxXe2tagi2daQcYAuhoWS9SVPO5A2juEuJRqDKOzFcO75AFniIke3ULcmtCw5OB6hltOoy3XtCVOzToSt1+z6OwraZKSo5rDlaQLOwhOjXXpsGbD49R34C5vQtCOvMFlepCXg1vPmykUmuMvxI3JoMgIgNVq2j+PLoSRDw2dQgOOejlI5p8TffTB64zUOzw5DrF3xjr2OYkChGyTeytCzCPLboEj9TqMEs0BmlAma2tzFsxVzY9NDajaQG7zMSDZ1UwJ30V2Q6k8GcLluvbCYQcyYeaFH5jZ+KNwE3y10fnTf5wW5wgglcp4I0uHPBz4V8E79iyfGNTXZRl/IlzZgXRDrJQWb32pCmuN 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)(396003)(136003)(376002)(39860400002)(346002)(366004)(1800799009)(186009)(451199024)(6916009)(66476007)(66556008)(6512007)(316002)(66946007)(8676002)(8936002)(2616005)(4326008)(36756003)(41300700001)(1076003)(478600001)(6666004)(38100700002)(38350700002)(52116002)(6486002)(6506007)(55236004)(83380400001)(30864003)(2906002)(86362001)(5660300002)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: X/q4RAcgxgU/u+SYUJKeBzZyiDYPBW36ukC5kLd6KnrfIQHOv7ThBIpQAMBIqJLjG7j6qZ3EL4jAZclDozGuY2jgYJIHA5E7gJn8KheKQ+oynBo+a8tbGOAPQhl+D8JXi4GHiO8TimJ8+qmk/SgEFRv7WxjPiPgP7hPOdDgnRofjfqDt+uGCCd352Y9PHvWocPCVaMkN+9NLjx51HsAxKQJbznxtDYbyBpYoLElFb52E0B2l5Qr3DNs4h+jGs5WJJs77ZqPjfoCT+YMnZLv8Zw2p2x4oW6nPEsCH9nUtGAauikqzkZLWJjjcaYJOVOHrt4JR18/a+5adI92x4W09TyuFvotKUaufj14PAjh7qawAEXkQSygnBeBM4bkV+Rj4OxlVufxx3l4UAFoeN0LHLHkboKlZ3xJyqRWrdXCYTFDTYfu+gGek4T1dcK7crfhkBRsU542jkP3skX25rQ4URER4R0daqEb/A7gMrLxmmJf9aHO2e8aCxncDLiofo8fuZzD0QgZyKn+JOMNPtwbCGsPZ691/KC5NT4p0cVuaqqxKa28XieNWtQvwZNjVZYcqoSWfN9Vx9slE4gaOYzcdiPC/pgrgmiV+dDgR6SyodobFz6MvJHsySDlmS3ibmg4bYiuM2zB8wuk68G6u2kDxhAV66moCzvouLNSdEKE8xuaCOjQBDaJ/NAYFYG+z29FJgtRoW4W3o60wgdXYwad0QqTRQ3CbcgGInllCEWjcY6mqu4E9HAGo7KmkI2oC835QLqgsZ3njVRPQVaWh0kv8rYFqQ1JAJE4I/43b9eQjrAazhOYhPkVgt8YkdtZ8h8MjFb0JVKGu+KR+wGK8YRhJUo3EvSFXORGea1AB6nKP0WoWCLDgbtWcrh+1NvultWp3/67A489sISPc1Vy6h+aSVNA9r+0pmqRt+9UZsqatMZqiiU2xgyhlsVy9FYW6BkIh2qhUxmuYcu2yBqEtWKVpEeBbLpRbpllvUEkFxgEAnjPlB6KrcnUTE3fxXqsYmPa3jMDfuqDv5tG7plnSYVG5uiUwr7h1S/v6t+u5Zsn9379wXkmJNNBUv6BhOh5uwdWsy4cfWnGOymkCxAxAfzjDAniPoobUJ2ATofS/EPubA5is3lQA+nhsyKZvMiqXnIsCfQwtwTDaK/rzPH1MTdlittvy0yyLyP4o/5VE0kPlQmdnF4lOgzU8rjYLUKLp/2XDSFgdDhpLArpJ3tAsxnDU0swVs6mHD4WeWcU+U4L5pCXK9AyRxWW9jwO98lI/BsiNopz7XpVxa/TEl5Z/WY9cmSFiur3nt3ULCwzZXuIJY3DDdUfa+wLVHvGzppm+F1tVrIhi5nvOYpsnQXGrh/UMreLwMpS5SNXXGI6tbJexuPyiqjyhD2Ipjtk+oknFUehurw9+oeS7Zz357fRu7L7R2zvucoSBYasG/KE7o3tP71EZJ9zpxz/Noxo+nnGkcrwuhx5VSJsjUErQYXa7XPbKNKQxv8bNRLqGsbAN+dL0UtVbTQk7khvLpp+Z6J/alVzVX2eeZcVTcRPEY4hUmwjsNX6WSYNBFc2e5Ndp3I0i31EmfhE2RNrkg5Uox4Pw4pee X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ca3bb737-ad08-4b01-f605-08dba31c85dc X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2023 14:31:50.5259 (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: /WhwC2zPYo2ldZ/He4hFsea95BeXL2U2LIKKXkA4+D2tWLtu89eeWj60qoGX9QQcAw9VzECq6g2/JQy7ro1RcA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8707 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 | 169 +++++++++++++++++++++++++++++++++++++++-------- src/shared/bap.h | 8 ++- 2 files changed, 150 insertions(+), 27 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 72ce67c08..1c43680c2 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); @@ -4008,7 +4036,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 +4227,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 +4254,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 +4286,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 +4425,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 +4482,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 +4495,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 +4968,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 +5006,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 +5202,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..edb5c1bed 100644 --- a/src/shared/bap.h +++ b/src/shared/bap.h @@ -289,7 +289,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 +305,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 Tue Aug 22 14:29:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudia Draghicescu X-Patchwork-Id: 715835 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 CC4E1EE4993 for ; Tue, 22 Aug 2023 14:32:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236789AbjHVOcs (ORCPT ); Tue, 22 Aug 2023 10:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236795AbjHVOco (ORCPT ); Tue, 22 Aug 2023 10:32:44 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2066.outbound.protection.outlook.com [40.107.6.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8327ECC6 for ; Tue, 22 Aug 2023 07:32:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G+6WgmKx1pY0YchR+GBdFh31yH6illta80vS7dGkrWfSwkGzz/m7VghgZt9Nxyxas2sGaJulTwV7aM1WIGysWlgEWU5PkEwTVodEY9rhN85I/2LsuSiu48wkXI10y6Xb5hLxoDbRMyo/TjsHHbR/d4OY4NU88C2Lt1YjYCQevlXQtkpUJACJ+I0dsYDYYvt8KFh1IZLZ2S+u1LqIhX2i2jaUmlNbF41jNv1z++SZabOoTfi8sFABmIHry4aa3+zKWirMb6znIDeaPjBbpskbc7PXiezb2yS5HktNliVxA8gJfc22xob8rxBLOChTVox/xC36HDKd98/W0C4/Tme79w== 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=+3N0iY0CzexGRDd4WnLCWFDA11dUahXP1xTYin545Iw=; b=GNP++nku5G11ZxyKGHG8OMIhRiIyxe/9eEJyQ6PQr1pZT7uwI2XYb3PmEguBCGo3p+GPDtq9TsXq3X1iq5fy/pQ3coHpmL7vfyB2LUGt5rzek0o332x/qCNRxIhSLxD1k3kjC4JeOOBxgZyBa5f/lapNBDDD0qzEy1HanQXXP5oOmNDttrC/wcjRNPzyQZZDsOoHjtlDiHrUhLnveZOJ2zegmDfjR5R5ksp2CBGUk6wDUD6CHcfH5OVVmco9mHsntJ1oicTNtKKiSKDwFHDvex4OieQC5g3yGHANh9La+ThNyJbWR4if2K60PvNXXylGye2hsPQ1L6t5e0OUTnjHeA== 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=+3N0iY0CzexGRDd4WnLCWFDA11dUahXP1xTYin545Iw=; b=KVPvXx4MSPcyKdtgGJonLyXW91EPrWu+HqbUdlrOz12cUJqyAss0FR8S8N0D5onVJ7eI0mQBr1/1Hi5hwjvdu6imX1Pspf65r8RW0wLzKEKBC0nO848qBpu11782kTXcm4E+OiZBZpu8Bppsw7PUCrVVJk9X3vF7EIqsE3vyd3U= 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 AS8PR04MB8707.eurprd04.prod.outlook.com (2603:10a6:20b:42a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24; Tue, 22 Aug 2023 14:31:53 +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; Tue, 22 Aug 2023 14:31:53 +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 v8 2/6] bap: Add support for BAP broadcast sink Date: Tue, 22 Aug 2023 17:29:31 +0300 Message-Id: <20230822142935.6016-3-claudia.rosu@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230822142935.6016-1-claudia.rosu@nxp.com> References: <20230822142935.6016-1-claudia.rosu@nxp.com> X-ClientProxiedBy: AS4P190CA0041.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d1::15) To GV1PR04MB9151.eurprd04.prod.outlook.com (2603:10a6:150:26::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9151:EE_|AS8PR04MB8707:EE_ X-MS-Office365-Filtering-Correlation-Id: 0e02f35f-7de4-4fae-85ac-08dba31c8742 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uaH1d93YrwOJ/yq3caGPVhu9Gdcr1RzBaRpTDnlYwiPDYHlt3dG+dvuW/QYNA+9/mZEKzQc8aFXU770EmFcPtSoIFsP38GNRaLvqXkC9cwbGWnrQCoEnrlIt5mVb6DOwCXBE7iNtjrwrLWuzFTbxMUwdb2np4s6YUltOI7x/u/go/IXYNPUYhm+Ya6bvyEgshXW8/lNNZOsbrpnRiHbGN71In+uTo1dxTnHTKk2btlhQZnLUsokmgqRveFysqiqe22d9xNVy2oe/RXRy2gQVaBTu5fdR+UxKR7eURKcquMmEU6QZISYia8DVKtBKfL9US0q8sUbMKN64UJxyEmR/QJHHR2+sGPCWsZK8viRrW1acD2IEm0UHhVPPLsN8O0EAbAbzKdB5ba93RinrUifTGQVFgacNtl0+FrL/z2lY9WXE4MMd0wpQ1PKEq/AUdMkDwTFtZwEL1f0a8D3QKVm09hZjzu050m4+WbesdFhaJCCQerdIyWa+5oKh7Qnv9PP2Y5sNQjaC9MUmarDGC9Jc37xvURuRRzkQlCw2ejh6XiftZ/suYsgBna7cI/J4n95Mb8M94qjH2ySovDajMkG8N61d/cCF6kmzf8K+pcZDzIRhz2wiGmHdpjlcsdJXAIyJ 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)(396003)(136003)(376002)(39860400002)(346002)(366004)(1800799009)(186009)(451199024)(6916009)(66476007)(66556008)(6512007)(316002)(66946007)(8676002)(8936002)(2616005)(4326008)(36756003)(41300700001)(1076003)(478600001)(6666004)(38100700002)(38350700002)(52116002)(6486002)(6506007)(55236004)(83380400001)(30864003)(2906002)(86362001)(5660300002)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LzS2VTJ8oVkMCV9mxFeavjwidKNe7fQaRRMe2eWIJ/Ch7WbVgZgU8xBKaU6onj+b8AFNuB01rZTGe0qTXS1WEVVLOVZaPCLJfpBgh6If8fyLbuTY8ClGnwzf4qnwU5zwXVbXf+axRH4lgFFp/fZ2X7YfQV5EjjcZ2Fy69n7zRjMlXweKYI/H53wyyR//tlblTjrdw3sApOSFz8K8CkEPPEsM3QZLWbqetkJNCUJb6zYTHYumP+QuoGOuFVK42wXLKhTjm7orhU3M6OcdXcNq5PAr4dpWDjVqAppoyGNh1x0UMnoBFKE6r6djkjiaI5w/l5f6qd6toGNkBkkGDvAEbVYxZ2p9jd2XeXly1nvhGD/xksWGKpdk7hgpHVT/+65/c+RjQQL8JxGxbfhD+HKe1stp4nsMwItmkZBdcUlIXdPm1nxoY7g9amx5lPGikPpn5j40BZ0O81Ondr3FbSOx+MdNt2OSayOzttA8dHszQwR1za3Z9PW236istzLp/jITo6hFaLSz6wYUYjUgO3kUYWpm/ehcuTKw25DpRiISviqBzhEVmiF3Z/eHm5z6VBD3ZrmoqJtyVq5QSGSMOIBnnFKbARrYDHwRJ42x2nT0I3aK3w/Er96/JCNkT53daPmncQXXknJeLfvDQrS1rvPo8QT4Sr6z41c3crs7sXfj6QqGPZNzZDoMv9kvxNQohbp5/sN62VMjGVbzSIVR4CGfJQqLcvqw8tRtyJeRupVD1KqMcYW/0t8+eMVwKzdtQp7bpommqy9XbTgWbTWjOqZRZtGF54HefYPbS5ExgmOeBoZI2mT1WRmcQHyt77bgd/zBfQNdwy41fpZR6W8oMa49H2b4DJH9RGGu+UBoUOB4TzF+o7xwAP9nfIVrOh6vyxh6ulIsuHrBcsK4lFYuH/KojoF8yBRa8cTg0jisEGrEXbC4DyQHZ3OMvz1eXBvoNp5Htwd9XiLsw7G0WQqaChAaHlVWpdG75PYsDMMZwhXD8OyzGuji4ZPkDhDWaYR/Wo/AEv3hi9vjST6pS6F/w+vkdE5OZa6bxfSkuU8ooZ0bANmhwj2EPM9h2UxrA1cEWhVeT3yVRJMvwPr5oIWLP3B8lJStkLmxQRbJZsqMEwh2B1tgT91blwg3sig1RBBFV6gek4ikYL3pnwadsxvT+GxoLGqvREFjZ6eFNyWIcxGB3Y0WSKFFfyHsX/cR2CAzcNfalopxc7GLU8BrNGGwfBul74Q3hUa7PGIAb3r5JnJTXqcGW8IaqTArGfnJPZ2kU4E4Ngdr/Lai2nOgFyB2rCyX8HxtD9ogD7mduefTWw/88Tz0CepQdzw9d521wTxoNYcWWAWvF7TMdtcekCxm0a4pX37AMCpRMT95LluFpnv24hCbEs5iGBJp9ob2+79yU8dV+RuIGqb4/u5FfC2x+a2RwQhZ6am/Roi94xkSG//P0cISPA4cJHE0xlqS/Dp4ZpxeINTCrztcKnihLi5vQUcwQMVrooarXika5OJiMDdwzWOjpc0kKuGqTFvL++HpvuCCcO1f9bJLwas6WgvKVmh4fUyqfjiscvULxZZZEi8w+Eco4HJAwFKy7zIy8/jXQwe+ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0e02f35f-7de4-4fae-85ac-08dba31c8742 X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2023 14:31:52.9385 (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: S0pEVYsxcebCuLiM5R2GDUHYha/BZXyQ3+KYbLILhJtL9WXLDB16SlXZt7xTEs5bD00WEa+jSbY/7HQAQzdeEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8707 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 | 432 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 402 insertions(+), 30 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 922eac50d..dfc71edf6 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; @@ -74,6 +77,7 @@ struct bap_ep { struct bt_bap_qos qos; unsigned int id; DBusMessage *msg; + struct iovec *base; }; struct bap_data { @@ -186,6 +190,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 +214,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 +268,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 }, @@ -271,8 +291,106 @@ static int parse_array(DBusMessageIter *iter, struct iovec **iov) return 0; } +static bool 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 int parse_properties(DBusMessageIter *props, struct iovec **caps, - struct iovec **metadata, struct bt_bap_qos *qos) + struct iovec **metadata, struct iovec **base, + struct bt_bap_qos *qos) { const char *key; struct bt_bap_io_qos io_qos; @@ -438,9 +556,21 @@ static int parse_properties(DBusMessageIter *props, struct iovec **caps, } if (broadcast) { + uint32_t presDelay; + uint8_t numSubgroups, numBis; + struct bt_bap_codec codec; + memcpy(&qos->bcast.io_qos, &io_qos, sizeof(io_qos)); qos->bcast.framing = framing; + if (!base) + return 0; + if (!(*base)) + *base = new0(struct iovec, 1); + util_iov_memcpy(*base, (*caps)->iov_base, (*caps)->iov_len); + parse_base((*caps)->iov_base, (*caps)->iov_len, bap_debug, + &presDelay, &numSubgroups, &numBis, &codec, + caps, NULL); } else { memcpy(&qos->ucast.io_qos, &io_qos, sizeof(io_qos)); qos->ucast.framing = framing; @@ -556,7 +686,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 { @@ -565,7 +695,8 @@ static DBusMessage *set_configuration(DBusConnection *conn, DBusMessage *msg, ep->qos.ucast.cis_id = BT_ISO_QOS_CIS_UNSET; } - if (parse_properties(&props, &ep->caps, &ep->metadata, &ep->qos) < 0) { + if (parse_properties(&props, &ep->caps, &ep->metadata, + &ep->base, &ep->qos) < 0) { DBG("Unable to parse properties"); return btd_error_invalid_args(msg); } @@ -597,13 +728,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); + + 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 +893,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 +921,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 +943,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 +1081,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, @@ -1244,10 +1502,10 @@ static void bap_connect_io_broadcast(struct bap_data *data, struct bap_ep *ep, g_source_remove(ep->io_id); ep->io_id = 0; } - base.base_len = ep->caps->iov_len; + base.base_len = ep->base->iov_len; memset(base.base, 0, 248); - memcpy(base.base, ep->caps->iov_base, base.base_len); + memcpy(base.base, ep->base->iov_base, ep->base->iov_len); DBG("ep %p stream %p ", ep, stream); ba2str(btd_adapter_get_address(adapter), addr); @@ -1310,6 +1568,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 +1661,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 +1714,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 +1726,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 +1776,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 +1897,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 +2026,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 +2259,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 +2279,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 Tue Aug 22 14:29:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudia Draghicescu X-Patchwork-Id: 715834 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 B4C2AEE49A3 for ; Tue, 22 Aug 2023 14:32:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235875AbjHVOcy (ORCPT ); Tue, 22 Aug 2023 10:32:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236627AbjHVOcx (ORCPT ); Tue, 22 Aug 2023 10:32:53 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2066.outbound.protection.outlook.com [40.107.6.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF604E49 for ; Tue, 22 Aug 2023 07:32:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LVy49WRY/e6y4KemKtXszcHu3DJd0XQOygqC2QuF87seQgRgfgyma2qpysnkNkYFwsS19kRe8zHHPR76vAQThtd0OraCOT/9t1lqt9BcdpKq2dCO6T+P7caJeiyVb87kR/lDWQsQWzYG9BVtR+wPYEhPZDCKcPbZtmW5VzPFhsDBMLtI5bywwjN4xzgJ4YXAQfrt7xl9DM1pszGoi1xvMqYewiKH4tScbYcBiRumCr6VtZ4ob3R+zPW5+J1ImDvFnd4HZTX4desDm9nxKwa2GYzo3CHPEqt7M4Tn96EX2ykxz/RoHnHkx+jCCRj0p00flHT73zLK3L6OkC+0gj9ApA== 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=USdDDI32hc3SEyCHFn7RCBELcBVEuajAbnfV6rW6lwdQxesVIU9UmI9wjHpdCTi4LA++rWZYArnfV7EH7w0OhEI4oZEGj/nZMDw55hTzG2SI8Pf41OcG/UyAz+p6IT9W3AmSgrioOS4l7iZlPe1ZQBXMIR0E8FPDupDv8fJIh0I5e18roVpLZB5/3F8+a+DcPS/1FvPlhTWDekjQNOYEOoLqdTKJC0rDFWURRm6B15KOrJUliwooYJKOFVdUs4LwBd2hhqgUk+4Jv1V2I/ZgQrWgjfWuivbBUBMf4ogF8N5m3pNHrBr1gg3oGDjCTYux0VVxPwRsAYqWqp6RkY0ysQ== 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=gUUAXyp8TbhdCF7chc+XaNm6F0/LhLcehT1KaniDxLkKE2FZpPrdQ8ko4eoKMkAa8QKjQJKO4n6Z0qG4CYCY770cw1NljSQfelaZbVlhLdi0Mdo+3M7xKpdttrLSwIKhzpFvEnaXtAox14tmakpc4U9TibC/JJWnHDU2eSanGc4= 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 AS8PR04MB8707.eurprd04.prod.outlook.com (2603:10a6:20b:42a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24; Tue, 22 Aug 2023 14:31:55 +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; Tue, 22 Aug 2023 14:31:55 +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 v8 3/6] media: Add broadcast sink media endpoint Date: Tue, 22 Aug 2023 17:29:32 +0300 Message-Id: <20230822142935.6016-4-claudia.rosu@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230822142935.6016-1-claudia.rosu@nxp.com> References: <20230822142935.6016-1-claudia.rosu@nxp.com> X-ClientProxiedBy: AS4P190CA0041.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d1::15) To GV1PR04MB9151.eurprd04.prod.outlook.com (2603:10a6:150:26::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9151:EE_|AS8PR04MB8707:EE_ X-MS-Office365-Filtering-Correlation-Id: 24672170-7aca-47a5-8f28-08dba31c887f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UpDWGlwLJbtrC4SSB48Aup7l6kgySFRy6WeQOp6ZP3TieO+4jFOZbXd4DdOT6QlViOjqwUAL5OIrtzslfONBcuyZKFL/z4itfDHf1MYDQQKmskK6+8Vc5Y8T4McZoJsGq/d6IpV0TrcEM3ShYWJRks5XbPTq743ti6VF5wdBiYzUB5yPrLtBhtyhWy0b1ERglE2uVnMYlL4S0p01dJvgN4j/XkKONFxYM5sqMX14Itgws2YMpHw1j4YgTXUS/JVBj8twJj9+j5fkKv3gHnToJRkkn0tfcIDQWlp/1+J3Uq5STIp2dgkqcgox4k4wwVoLWH/LgNPCUD/y5q/9bC8fS6Q7JU6eLHVD8iiLr7BpLIRHE1ccf58E5rFwIu545VshQiQO/z5/nFqxCLUOWawfQAFnz+X+QLMwL3XaRdVKZ/+NRN+psGEU9OAbA6NCo+dE3fwDScvbjfRgolymiMDvAZ9ekJI39TCDeYu+v5TAV7N5lJ0zHgkozXAyE/KII9aKm1KYtseprC2Z8tVmKkp18ujeDSumVmif/4RqOy5FaCAPM3wKiH4l52s7nF9wz+slc3fXK1QNrCpWTy1eQRMNW6aVcwYjd0dTVrY4wRnqAU/dlZCZoIcSfMU/DbkESmi+ 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)(396003)(136003)(376002)(39860400002)(346002)(366004)(1800799009)(186009)(451199024)(6916009)(66476007)(66556008)(6512007)(316002)(66946007)(8676002)(8936002)(2616005)(4326008)(36756003)(41300700001)(1076003)(478600001)(6666004)(38100700002)(38350700002)(52116002)(6486002)(6506007)(55236004)(83380400001)(2906002)(86362001)(5660300002)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3jccg7iKdhCcRlgADj3Ql51asVCZWL0ut4u0P0h3sjTWEHY9Fi9IwzJsaiwa6jk19Fqjm0f4OAHUB1ZoOfyeTVUYoIQNmQylvcLBC4VaP9wNjpGl/027bbGUY8Cck/Xa/fyn6pjgu8xQAeZFXI9ROBxiF2O41SzkYxqKvBtUij1Mq7PtkpQLQhhe8fWFHcIETaTet+oyBBsnbHv8VIHEin6KHqFLI0FPZNuhqPpcBUXRGY/w5zgmjDwDJdW7XKKIgg0+G/ulrL0ybFgS5h9ZLpB510BWg3HrgC6CY2gelKbk7a1cgFvNmAVpWqmB/T4EbHjVmuJhd+HYbb7pp1GU7ukOb04rd18ydP4CkNNH5TZF4I6Dgax/M2wT8+TKcEruIcRhhwYiBZeSYFAxDvU73HNfraXNxZhKWnAydFK9Gj5s3nYsGCvTvy4PfTl7a9PpcqefP8kTn4d+i5JLjUsS1tuhnVCnMWhzrRa4gtkNgm5eB4K0MXi+UI1PxFe/FG2UlH3qbWidbqW+hlABz3oXJJ6++qY63SFl5V+D1hWnSJXAizRX9c5RCRd/aoa48DVXXSEsb2oVaIfzcWNDwE3ZunpvZEDqcRDK3ibCYQv2B5+Mv0d5BeZjpJloV/bysXSqpEAgFnI86kdvj3Frc7FL+noO/DVymXkVCyCgMBGivre7CQ/CkZ3XEzs9j/Ta85/6+0+ImGpHXRxxhTF8tG/bzjkoE3SOrmwijcZFpFPUB4AP3Ati+54KQnfZl9Ss9BAHxByZ1L5dZscUr51AgpMrxUBGr4UfuuEnpuK9Yui8dxqVkKrO8LL/hrAOI6typQw9k1nRvdNA8e7FiheYBarHw6Ld3WVEh6m3EDPBIeSq2wMslF5iRu/V2cfxRuwj+GifUcATOZRhRcGaar73QsPmK16LrUhd3zpRVuIOyuTCo9PTP3yKi2C/DXi5KJDj4nGxdoB3dqMcwEGE6oDtW7nEyBYIdKf9kE+9G+9lRIqtpAuRbLXoKBSMjlbIqUrinzr5MACSLxgWJwsjYCAGWWHA/z8FSwbM7XtrYACcJvV+zZXKNwV8FUPa2IHI5ZuHGVdM+TUMrv9WfItd06W6Y8G0PdP2xmzztYSmo99JiR/XP/8HynR+Ac8qdh6lBRKURlFbr4oQ1TLzmnDIDWb6mcKrnLFrEGL3LY3NNYS4tLwZkC+O5AnT6ckTW0AynGr4aktyBmiISpYvhueRQh0nfXNRi2EgFhD95ZMerIIT7eso9+eD/vaKcYxQU+zXeNYqj0/yEg+X8Y6W9qY1TVZwg1oN8R1SR8tJV5bpgAz4DB90PdCqx6YgXAlXkouVukhfhLMBIzwu5rvb6aK09+r5ouLup7CyEgNAMXAtReDMgOlkHLm3uq4c9sMA1A5yAKrnQFM+F7tfEm4QwgT794rZ/wjXgjl/1CDd4EO3icgqRQY5oMptJjuq9mwZen7p2w/Dxc/RSRLMrmzRyVaCgLJ2/Py3R+I9992kKcyL4c2onyQb2xpHgKC+dJj2KZ1vG5elu0qkUaRH062Bx9GNyW+AZjolzrwYGxj16m+7mP2EIxGel9c5bx16+h/Q+YdtmxrgVyIy X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 24672170-7aca-47a5-8f28-08dba31c887f X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2023 14:31:54.9021 (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: PfTmaiOAkfcv4Px9yARh9pePkhz2K/LY/IJrYVC17FTx5a18wk3itOKrV7VCQbfWZijpqMyn+dDd2MzISFnueQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8707 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 Tue Aug 22 14:29:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudia Draghicescu X-Patchwork-Id: 716628 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 50D4EEE49AA for ; Tue, 22 Aug 2023 14:32:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236790AbjHVOcs (ORCPT ); Tue, 22 Aug 2023 10:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236817AbjHVOcq (ORCPT ); Tue, 22 Aug 2023 10:32:46 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2060a.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1b::60a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 657651BE for ; Tue, 22 Aug 2023 07:32:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BUZaYq4coYlnTmURWgVeg4h773MfJPatjEuIfOS11zFRArGl/HGl9TkuXkXbxE5ocSsrJbBbP3Q5+KI6VXRJoLlB6IcCBcefWwViPNp2qoEyjnDDUbiHnCbOt8aK152XaztDNYiGPbzfYQ90bQ7rs/ZZ6IGPAZDw0QfQkyGOOeq36oGWRQSSLelTeeHwm1H571YSPm1WYhsS2wyrjGnwHHmZ+iX2gZMQFMAb00OVr/O/qLRLzchq9atRsq9zZ1XC3q9w0xbjQNBkV2R797BjzLmO/KkQw3j4iBMoFkxxvji+qCAcJp3QQ90cFzwfPEBeePVFQmd/QvMVAL+oA4rIww== 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=mgYwAz8zG6mhggY5DIc/rdJFd9cKBflmMAKDmkkBX4IGxtO9No7gOa3MsrbaChaV8++bllXG45wBJTdV2DVnO7gHjB7rc5j8+RhPlq+/W6ZCFDKIUJp0/7FoSljhL+bMwkxZcqcAD0/3bp2evA2o/MWd1+9/1yFqrQFkZgDwm0xtfC+RNe1BBULud4g398KNJvnOoy8ZGShbXLsvhdir6OgpUcRWlHBdBGutxsLufvs9q6X6bnpPbIFh1oauhsli6FRSSKyBh7NDO4c11hjzyVLRYzwZmOZy+RU2Oejjy1C00la2wmq7DZMsZAQrCKEzLFA5w5SWUlK2um/2nW1Hsw== 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=pUSpv1sw6nGfDV6C6Sk/99ILWqtHmnUwEhcDByhOsc9WOc1AFRr8PrN2rT8rgfs5j7R9nzClvj0Mo/ekpCdTucNtAMPKwrE0OLUZHjJJ9Q80SDpo787p59dZIxV/nU+Wr/12VECN3e1Adgo4MKYC6Fo9oNgDP7D6AaohBQantnE= 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 AS4PR04MB9689.eurprd04.prod.outlook.com (2603:10a6:20b:4fc::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24; Tue, 22 Aug 2023 14:31:57 +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; Tue, 22 Aug 2023 14:31:57 +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 v8 4/6] transport: Update transport properties for a broadcast stream Date: Tue, 22 Aug 2023 17:29:33 +0300 Message-Id: <20230822142935.6016-5-claudia.rosu@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230822142935.6016-1-claudia.rosu@nxp.com> References: <20230822142935.6016-1-claudia.rosu@nxp.com> X-ClientProxiedBy: AS4P190CA0041.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d1::15) To GV1PR04MB9151.eurprd04.prod.outlook.com (2603:10a6:150:26::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9151:EE_|AS4PR04MB9689:EE_ X-MS-Office365-Filtering-Correlation-Id: 5be46d17-a931-42dd-c279-08dba31c89a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: G93bWrXwp2trkx1/w2qQlJhJWhs0BMGFHiEDnwS1j7u9p3gCzV7kfnioeN7PxzSPge19zn6NgEU1y5D6uY2XaMOGHHvh+tBOwtjkah66mSSKMTGSWJpgyvc0kbttPwPjQg0LrbZPj2EOAouSPX7opoiJgtWzArVKlK71g9XHqBL21mdiDcqw+iNdUWQRJr9Dh5a1cLy8cytWxAgc9Tf6dUe+jY5VO0YWw078YWde/9b6/fegWlBz5z13UcOHiyYmeKq/WGZJVs27bWI6IOBs2ID1ii/+aLJXvySWos/s1bcMs5HKmAwq0D2y8KMsJQmDplbx3xkyJ4r1G49MTPzfI1O164UgNw+nNhBJhTToDlbR/k++xDuQXXZPKn+bqLLMyyAuBnXwXPTXzHBlFjLiI6RMprbcy/GmRVGDxHZZVKlCB9UmN1Hl+TioaAYAKXYqL+0CzWVT43FBmnJlC6cYN5L50f9IRM2g4M/0V99p5eZrrjlkRCpeJX6fhYDwWQ9uBHcA7zm+V9hnP7IZG2NxcKc2RHKEj93ylHviGCWtFzXmc5AKtCot/EnXSQ0A7IcHK2NHdTvjnNus30Dpyomlof/86Prf9bRVrGogE3zvio7S4eAVdSJ1fcbWwE6Co/RW 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)(396003)(136003)(376002)(39860400002)(346002)(366004)(1800799009)(186009)(451199024)(6916009)(66476007)(66556008)(6512007)(316002)(66946007)(8676002)(8936002)(2616005)(4326008)(36756003)(41300700001)(1076003)(478600001)(6666004)(38100700002)(38350700002)(52116002)(6486002)(6506007)(55236004)(83380400001)(30864003)(2906002)(86362001)(5660300002)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hcnBgAzD1ZmvlGE/pU2NGrf95uEekQ8Lvp2+DZ6JjYQVuIUUhkE7O4uupDwHXUkxfxY7HLknctlo1NEFBBEZ4YcCSyGoTaT3s7bb1AMw/rG/+Lnnkf8Y/5QQJfNXJ8r5p1aFaimrPjjPBZhsQ5Kht4BsD0atnZ9HwrW/Ku11WqPKSrpOIDXXfWc70zOaCYqG8aE5KpzVRdBfghxP6MwyPhAdAzv4h3qETBsm7Y1SKr2dYeEn3OmYidaxEarx7/agOyuVDdxjPgc+TfMZSAZfINtEHGbwCk3Ap0n+Nu/EGa989zBjUOfeyb+5wR7oF6BlQexj7jQCzuZdKKrWPoxFhLT8aNClUYnncLuOv3rLyTG5wat/Bi9he9RL4Iu3IDznGIK33HvXD1ZEb2CGz6itqjGvTHrveifKp4vt7HPtYZoW7GNX2yC9rXdVkpDdi4Yp2swOP12J2rJ+oOOGXveYUyFWENqVDzluxmdz549AonWbDnKa3shmmHhFYB4CQC7On9uTj1of8kEkM2HHIK5/hzb7wh6Qxz7PbpAVmWpCdpcHZc/nWEaMvmtDbekytsciSazbvs+5DpKI4fifhvtmepEotPUiO7Y0e9kLMeqNPAfet4YP3F3lNAUjnCWTUFp0NCe430oPYE8pD8EyNcUiS2cSgvL8JWHrvULKQAyXEuiM4+CH0ZTEVZzcMvA/dtJkkwDnzJ3sMFpSPnI1TTtUIaOxGT7nIvq62jPJM6ttOQB60hG622LdasGhNiTfxMerORMslBGpjXvIhbBq6dySF94S7ToEiDpNkejxbf+F80u8wrXfsydLHlOQwQsyYbNGYr8Oxdku0bW1qc6jnSDSvPulfdVtSTLKB8ubQFccmlDlQpWQtWVM/GnOA2s/v7TWyOZom7nlUaNvbMJIvGvR7E03LCLZxMF/r2zNMWDa0CtFvGhKCT8qnwrMEWVmOq+VDzWnrtI9Z9m79j0QtexKPE3ugY7JX+LiduWCpSXhKhpU5BnrrWvXpiwE7bDuPQNinLMd5bSB3DYdcQ5IXBOGMIPWAqmw5Li2xzYDl/RZkZSgGBb3UzwnPF42kO1HDAs0jSdyFpb/TNnrABrot+LBJmvEjo8s7YeQoJOjpks+Pt5v6kRfUUDlZAC9w/eMHY/piees2rhtHjDhc5VYV3eHi6n0xb98kETkOUEkII5+9s2DJFJyMFrZ2TG6WEzQsBipt17iwfvc5QZa2/P9x4zHOdiGckiCkNWSENeOLX/WF5mAPEoI9Uk55y+r9wycG0XSEQc8+BgJQVfX+Kw5XtQnhfDECdLk8Wr7SF7rMbVom6lkQmODaQ/aZU44L7IhbHbCGfhipOzzJkYwNMvofIG6jKzftBnii1OkaKHk0YTE83GMwyZSi3ZJc8wQ1jDQAeDOF13YGfAvzhqEprgVllI9DAaM1+GJIIR4wKNJThaUrMtnTgOK3zfhULRX4QQPxTpijM8sghd6P48ADfhQtuRT7gY3QRy//9vXvvrVaSjloHMcO5/4OPlNtk1HLtzgf/tVNqiF/W2TOZ/6WDHAev95HFE/OdVc07p2FlZ7BT1oNYMxI+xddjW0L7aWgDomp/yr X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5be46d17-a931-42dd-c279-08dba31c89a4 X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2023 14:31:56.9500 (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: sVHBjUUpIaMwmaQ7qIIgaOgOWo2wnWkOx/1EJI99kSNuvi17PqLj44G1l8jeFi9GmjmbNsGBbgtJahLLw9lQ4Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9689 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 Tue Aug 22 14:29:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudia Draghicescu X-Patchwork-Id: 715836 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 5972BEE4996 for ; Tue, 22 Aug 2023 14:32:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236720AbjHVOcb (ORCPT ); Tue, 22 Aug 2023 10:32:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235198AbjHVOca (ORCPT ); Tue, 22 Aug 2023 10:32:30 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2060a.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1b::60a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 818E1E6E for ; Tue, 22 Aug 2023 07:32:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dmvwcUd/1WKkwdTTqSBgOdadVbobNZzoXqqa+oHBkmDL6l4Kq4GxMJwAQ2C2NtgYPQClWfdfZN+Fql/txINJ3rvewuGeMeMZIr6GZFCkHQI/NaNyDMPG33pp/YhOnzn3vFzRl8UuYTeNrnpQhrsqbKBDbR3Sxf0wOUpqNKfOooEqsEvPUR+VioJtRq1QFGhgIJXsSNAiGgVAIozGwaqXYkNmQU/Mm2kbU+KiZko7/x845bXSTJwH/rOpg5CVJoxcrpgaVOHHBqGVpBSINxaeN3c4toFoqYZ9qzGzFO1DSYjIiPqstUc2ViSTJV2bwyqC9GJfSFCab4YsVD3H8bKLXw== 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=XqBQNL9+mGBD7pt9UrpoAb0LPBXBcKno0/KVktTLh6U=; b=KKXYYgJH9trWj4kkWIzwbrpT6H9YwlhHa1n/DdOayHQmc9lhnDdrnUJ+rM1s3xOFoS9JDuomXSzE5+drcpnf3RokvlbxkXBISXq2ryOQk6cMsgUvgZkGJVl/kuJJl4fZKHrS8o6H5wqed25Ii+eAFmXdbequBdvSwhrdRL7A5JZbKzQBeHNS91J2L3gWV2wSyoJ0VWAF/yDfsa/FpfxEt2qDURFkVrY9jn3MZ7607kkgaP7oZv4ukz/PLOIXoWWfJCV1laKDRoXkpHhbP2GZFkgwilcMmNaHX4bt0LO9VxyoPfhymDcYWPXdfScjOCSAlnWwnHAjuSOwd+5xAjcNyw== 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=XqBQNL9+mGBD7pt9UrpoAb0LPBXBcKno0/KVktTLh6U=; b=fBBBLNLvVlIio8XcmCarx7wrC93cEspqa4a2xtPp3IVlVWoE9ex3tLCb3sxgEhaEle1o7nUHCuIhH7ncpVDA/8+TC5I79ldVNBk4SBw0kPim7AHdB2CvY9n/uhOkdaiA0WUBo0/WvZn/JV+RWCsMCxB0KAtIx2Y62zaHNmP2YlI= 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 AS4PR04MB9689.eurprd04.prod.outlook.com (2603:10a6:20b:4fc::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24; Tue, 22 Aug 2023 14:31:59 +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; Tue, 22 Aug 2023 14:31:59 +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 v8 5/6] client/player: Remove Broadcast parameter Date: Tue, 22 Aug 2023 17:29:34 +0300 Message-Id: <20230822142935.6016-6-claudia.rosu@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230822142935.6016-1-claudia.rosu@nxp.com> References: <20230822142935.6016-1-claudia.rosu@nxp.com> X-ClientProxiedBy: AS4P190CA0041.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d1::15) To GV1PR04MB9151.eurprd04.prod.outlook.com (2603:10a6:150:26::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9151:EE_|AS4PR04MB9689:EE_ X-MS-Office365-Filtering-Correlation-Id: 0256fab6-a77f-45bc-51df-08dba31c8b0a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WmbduBLS9usmW6cSY1Blpz3t7OUK2MbzJVCSxDGKnf9yFXaZlxIGbEot55IgPkD40MZrlDlSC9nlnBISvkKXghK0Ylt+7Pxy4DngB1RkzZBM6lKg86yUcgl4ceBYsZWgDGRhr6BLgZUeRBYs257pljArV05MtmaZlC8lE3fbOAm2E/kBbYdJpIUZbJXxojc6KQ6rq09YFijhhU6XyHaZu+Cv4V5mpK1j192qtgMGI8ZRmSQdybXSvv8qqRWwzRezlDCC9xWb19dWOEAiEHwN1Fi4ZfQtGwFmlHcnK4Pf3UrK9Vm04M6lFKf9G+8IMXeT11fajWP5MQR/jN5ZykpxxlboTvW1/fhz8uUHgTZRv16v38jEQAvp0AzcWe/RlXFOzJGZhJGfyvvHQHKht8JKlQ2Vl7CdYExFtCrtVdk8t7czxyLDPMe4HkXwZ09NG9p7JHPpYcglMA3vFJy7v7nh4Dl4IxatY00QJeFu1kg2Lv6sAxUxEz3ebcBoU4iam3DtCgNvAih7ZCR8+uFGDBcz6cIDizp2MOk6BHskJ2r+8JYqY/DewVTpYudWadp/LSRjPWMFKM3cQeE1NI2QLs3ZEHMmEgd4/jGadkZoGDe0zLJ5qrjMnvqqbo6+3v8LYHe7 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)(396003)(136003)(376002)(39860400002)(346002)(366004)(1800799009)(186009)(451199024)(6916009)(66476007)(66556008)(6512007)(316002)(66946007)(8676002)(8936002)(2616005)(4326008)(36756003)(41300700001)(1076003)(478600001)(6666004)(38100700002)(38350700002)(52116002)(6486002)(6506007)(55236004)(83380400001)(4744005)(2906002)(86362001)(5660300002)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OWOW7pyIp3wPrfsIWX3k2aIu7k8GM9X7SjQLECB2KLr4JJay+24StYicLCmqcJmXLJqDdVn5FvfzO4v+uHicTc0ixmvxz96s9OYChMm5klIW5G7vy/HmVH9Vn1ezNcMJ6EvJsegkg5gdKI1/Oj11EkP0sDveVCajXcJWsKxZy4u1HCfUU1WKW4uHLdG0A/WMb400nMRHuqfTlon20mD21RdHilVOegjK0rWLzmduU8UnOVZEdkvzOH7zzO7sr9kaOKZpvg9wsdPTX985g9idFhsOatdMpN1Byxa56Yyy1j1BflqMprZWf9wAYs1eiUWz9dKz6ejtACQ4cvRWDaWkIc7atNeIi1XgnHP908wsOogm7fw990nMh7r54oY6cjgMod4BlAv3hQ0n491LhzXqb5h0Yjm6+T5/iFRO9uxIsR3v6dPlQqSOkNZYnH5YRNSdTkX9UQ6VpHipb8YnNpwRTQli8sAfZQ+NRQYvZMBbiinVkduI5rpSUtLmEEySiupF54KWS6Aaz45zy/YouE+EB8blRVlswuWKidElpJoGRYJHaIuJ5QvtwWtAn7ZDcN50RZZbh42P17YAYEu+5UJoExCLf96IadyaOgw4Osg9kT4TuYYR3HD+la+CX/d2hK91YqWBnPeALOmmU5d5YHyVPAQ4qtO8SzuTipwInytlF3/1mrYnTli6vO/NXfS1OWb+mxfqpjCrA97AdoanikZKaHDMo3+DKgxFQQRbOavAdrTEC4zEt/cAdjZdnpXX/g9hLQwZwv/fg6xspAZskRoe6ii91vnsXA5qTWbYqh9dVhi/MBe4eDrTKJ3YJFNEMeTqlAY/nuaaZiDETdjDScmk+uBmu/VVTusqJYH1A0Q8aDPbOsjNUWFdZJwHtuaWMO9KK42aeqNiedj4yNPtk6NrCdZ2C+IPZ30uYnbgUqXxYHG+I6IuCC2pUVxWuxwHmEddOeDhgkAAVqHxXK+Jv80yXoiG9lOFUosoB79zmWGemIR2dOjrgb7AljwXSi1ZxkMe6k662KCKcCRtDe5fk8DMQNk+elctGREelmodQ37XJ1UPWe7I8HbNMG6lw81MfT8lrIXq+5g3m6RviQaO38glOyryeCr6eaptbGw5XAMmh2Dwy+DQZE+Lot58++RL99UPnI9q3aMigk/VqVrmhI1ZowneBL3BZK/wmXV/M5SERPqcmoVVNM4b76tXgm9TT/7koRRMVH+Pc34PuLKZXuMawe0oHWawxTHmDtrWxcDBoQzy/PSTwm9V7Y94AWrUAWAql0zZS7bcQqjN49LH8+fKjMY4NbOvao4Hswyptwh9SPvSlPqt2k9pj2nI7ehgtOwwRWc2Uk9dISIaBPYjfEpny20adqBDncfSEZhR77Bz2oVPb0IalfMqPMoaGrnrsi4ReFu0fCSrio9ieJuWrd2gSdU2P2/EeK6zTbTmXAb4RUJjd7GF6lVImbCzc7MckvgZ6dunrI2xLSP0W/899caTkcGPxmIuNu1dHOg9XjCvTt/7Tombk2F3+iVTiH6ZHhI4ZvQ7Md1jtlSiV9A0tm9qhC+gblPFY/MMnR5la9xXfYPcYbMi9FTr8VERCPKORtJK X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0256fab6-a77f-45bc-51df-08dba31c8b0a X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2023 14:31:59.2198 (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: JCjcBlUJRpJi0hPkDG64QGs+8rJWTbe86zCZ2DNp/ubD2ps90ogDyK23mShRemTT+/ODq/yUUnFHIhvDSDXoWw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9689 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Remove unused gdbus parameter. Fix length for Codec Specific Configuration. --- client/player.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/client/player.c b/client/player.c index 3611a8dfe..42721c210 100644 --- a/client/player.c +++ b/client/player.c @@ -111,7 +111,7 @@ static const uint8_t base_lc3_16_2_1[] = { 0x01, /* Number of Subgroups */ 0x01, /* Number of BIS */ 0x06, 0x00, 0x00, 0x00, 0x00, /* Code ID = LC3 (0x06) */ - 0x11, /* Codec Specific Configuration */ + 0x10, /* Codec Specific Configuration */ 0x02, 0x01, 0x03, /* 16 KHZ */ 0x02, 0x02, 0x01, /* 10 ms */ 0x05, 0x03, 0x01, 0x00, 0x00, 0x00, /* Front Left */ @@ -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 Tue Aug 22 14:29:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudia Draghicescu X-Patchwork-Id: 716627 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 6EA15EE49A3 for ; Tue, 22 Aug 2023 15:05:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236034AbjHVPFf (ORCPT ); Tue, 22 Aug 2023 11:05:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236800AbjHVOch (ORCPT ); Tue, 22 Aug 2023 10:32:37 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2060a.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1b::60a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B588CCD8 for ; Tue, 22 Aug 2023 07:32:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cT3MgZhRlzui9pCTZsm3v0tJLx7PvSAWGc0bQwQxjn68Pv5Ao+9+uI5+sxGXPN0SMircVq1kQU1Yss/KtcR/wzKIpsGdjlfSMT6BoaPyheJ9VdDI/VqsSNpYzJ5LgrkcGAmLY+sS4PqxQWTlgQGT/wcd1cipmguEbQFv01TXINJN3VkshnPSSZkzxTMnHWvC0iis6sD+YoPzBORIAHSPrzdIjXNScH0o5g3ALkF8gQSRLNO46ueC6s1AP2shdhRRR8g+0mzxvmSH39PlzVYZEEmKl7fyXTbnMhGtbB/9ca1kwqoR9pcK5n+yrBxqOIqVXp2smdR7cypZZOnR27pf3A== 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=S4kcsr+4k96TOe8Z6Uwa3n5swJsG4ftAco9Bqj2TUFtbhpLlR/UxmhWB80Oc59s2hh5sZj11apyaqUbqqih6OLgNS3bnqsl51qaqyd5MohfVA2sAbsciXQAAodJANk5uTv9DuLj5D+s8O5J9dgWxiUr45ZkjL/PBi5oEoywDt13ms9iYF2tczX5jk+8DDoX9oJnjFBmQ+8z3xXwoz/O23C/UcIJBmNhIRKFcXK1DPKjWaYpWVytSBpN7t+IgyaP6gvEVIyummNQPAJah5ymrXUIx21Z8qD9x7y5xpIt5FVaoRZaBr6GQxyOF7LL7Xj7UVjyHBgABQXXYIup+EmcsSQ== 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=ON7kMGrNVqHWW1T8dg4ukIW2jTZbf1np75hvi7B4NyuIXfLeltKSHAdv/S06ppKHPuOEYK7QGE0tSkPTuJxvqMiP7VuMP/qM/o5Cv0T6zTqeDjGhM/gBxkBflZTppLp36QPBIUsoHKUmTj3LtK/uDYF6qp068JmMTjvb087bs6U= 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 AS4PR04MB9689.eurprd04.prod.outlook.com (2603:10a6:20b:4fc::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24; Tue, 22 Aug 2023 14:32:01 +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; Tue, 22 Aug 2023 14:32:01 +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 v8 6/6] adapter: Fix UUID name advertised for bcast source Date: Tue, 22 Aug 2023 17:29:35 +0300 Message-Id: <20230822142935.6016-7-claudia.rosu@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230822142935.6016-1-claudia.rosu@nxp.com> References: <20230822142935.6016-1-claudia.rosu@nxp.com> X-ClientProxiedBy: AS4P190CA0041.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d1::15) To GV1PR04MB9151.eurprd04.prod.outlook.com (2603:10a6:150:26::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9151:EE_|AS4PR04MB9689:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c260471-4d87-49a3-1ff4-08dba31c8c4c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /hY1swHvVMoHC2VFoaR3e9qS6q50SYLK//jIE2HOMYo1WZShijOUmVHjiOpGapgb/+RtD9QGp9Bad593cQfn64xQrJsUhQW+Drsm7sUS8OP73Rmav/j88Zig+/eGBfnnhT/dpLpT7w9b8k6hWesCPu86PRtVqGz0eexkVSXX1azbsQDoCFmSyPrfAD57cCrKLQ4uAw4+p6Bys8U1P0cFQiLWQMFlaw0NDQYybJurY6EfVroXdLAbNiPDie0uH8aMFlRVK9MEWa/XpLNRVBxmxj53VPyTx1ZtRkzbBWNxixLJ3HOp8pE4P0iAgwmr/k5ftoyrHRyLkiKrziu2wauwugxj9+tkThyLvddu1f8903WdAlKYUWguMCDFvBDy/w1wAqTx24+P9vUNtRbYeV4V+qK6NpoesupoL/GTvGd7sOS0Y0r0OnS//PsYX/MDTZvVISmSWadpLlxjxB+5ofA5blvP4+oAdIQ84qRrIhkUQq+VlFUJxj2BWsGw2J4BbgHO5ASxi8Mlbm6F7VK4Ovcsdbo3/0exY/IVHfF5D/JcVa30HVi0f4lOxOcAmWaRAuvgHXdqWF+Y3bxE0xCK7Mks5C5I2osFlJn+T1UB9lDcF4Pnr0LzFA2H0tpPmGfSXPd3 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)(396003)(136003)(376002)(39860400002)(346002)(366004)(1800799009)(186009)(451199024)(6916009)(66476007)(66556008)(6512007)(316002)(66946007)(8676002)(8936002)(2616005)(4326008)(36756003)(41300700001)(1076003)(478600001)(6666004)(38100700002)(38350700002)(52116002)(6486002)(6506007)(55236004)(83380400001)(4744005)(2906002)(86362001)(5660300002)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bACsbltjS8D9SBlVP2ysoIy3tfM9a6cXsYvVgWjCO122GfCUkDmstX6t7hocZnQch3Szr9eN3jfdtTVmG9ZA7qq7olLVEN9BLZcYuOXqlXeo5oTqKflT7QxuM9dR9/cPEwSXA6uXFu+xdjDqrsW3fvgr/l/lmHzo+PxL1IeDsZuz/73203RHkh1JyfgkY9qlzeWnPnc2OZbvUCXzqKzFI0V3x1KckCbGoet2sF7VHrNjjW2+LtJa7G5h5J+6MdMvD0DKuiay+4AYZReUvy5rfDDzT9qbSULuOF2/fqIHHpMskQ+FHkZXyo2SRhTiLzHBVOYbbke29TrBvzDFu6JDqPUZmtKdqP5ZsLgd/lv1y/K99t7P1oCu2acAhZHIGrlAYxqQunnMX8nLne9BHVMwusx2x48gqKuUC0oaNtwMgS2iJPbhm7RUqiqJP534I+k7s2W4GzlSObgeo5byjBrqqokSJ8LPHFNME1bj90krXgpt36+cMg38u5kK3D0ixgYum8EfxPDoYaCWsub6nOmpjJJpHhPiv4EHxJ8ZohSiIsQh6ioz7Xj8BjO3TMb0OfwI8A9cT8S6j0Vfu1HdQqgFzx+2Ocq/hNDNzZtz/M9X8NesSmMHjTXBJDIS72vEQnm4icpoour8KMrcbsGgQi+UHxIjqr0x8HXe1mseZnP2tBbqAOVUrh2tZNuAOeq0pVfTLbGYGwtxLYNdmISxF+51WOQ+P0chb0lhClboiKXq7Su/0GubvlPk5N9ZREzJkDnFyKl5RM1oEKVuX7gQECMnLiCtsClTyTQqmSN2ZiPJQaE0FSPBDzCeSPZHlHwRQVNn9pwFkuVKzDVdbTYdOKQZtsMnnjlcQyS/CmYjUEB01DseHknad3JBTQfVSNK/jLxdWyF/Gkmr2UjvVpcC9V1gH++639bTzAH1l1NxtMmQ6Ip38ZRa+sJ2zHPvXyRiBlPNF0zksSii8fGeeKoGnoOs6aPM/HPzZF1nEmbdrheyLXLrQF1yUjuwfE1BlK8Utj8YQejXSwVL9P6sfKkQpuHkmIBR79ObfjlAdb6qU2RNwEGw9q56/j4InPgbhImn1YYjAstQMT6z5HSbizT8yMe45YKztSBS35RUFfrKmS55eXqZQ2vjaKAuRwZPEfY4YsnJDSBVH0jFw+ASuCYb/InAWai0XcamGkJtDfxKZuWmnQsUjvF6+fHQQ/vhokmKYUVL57alYXgJPIgWD8AA8XyDUdkdRwcorsuIojlglbB0IzbTFiTCGLNT41Io99TPB6GKgTzJWknVn+SiVj/8b8p5/U41du27Lq8utNaPoYMu/k2SBxn67IjTOpb4sWfX2g9HaSDv/Pw5x3xZgeehPgcEnEPSFboSDt9UMhmTllGl42NlZi7+6+7JBjtKYc/wA68PGYJVbCg5l5UbOC7MFjPR7mT6fM9H3/q9xsCAZo/2oqyVkqD+rOAlCtM1lIqOKiu7j74WIIuzDxAuU6ktdFjWNdv3F+oXYSv0pm2Pa1fETr94qs1dizgstG5kesY0SlXyrI9hajgRb82uHrB7qwOsICpj4mzTX2ad36jeYo/eKl8A6BKDBOXS46Ou8l01O3jb X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6c260471-4d87-49a3-1ff4-08dba31c8c4c X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2023 14:32:01.3415 (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: Sg02GThzOpQ7SFjI8I4MozfCpbUPYjwyBSTrLuhHguYyYNyOB3cysZrifSlD7AFhjGK8LcCMqDyUCPZNqAWu7Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9689 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;