* [PATCH BlueZ 0/3] Update bcast ep register and config props
@ 2024-01-29 15:29 Iulia Tanasescu
2024-01-29 15:29 ` [PATCH BlueZ 1/3] bap: Parse BIG handle at endpoint config Iulia Tanasescu
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Iulia Tanasescu @ 2024-01-29 15:29 UTC (permalink / raw)
To: linux-bluetooth
Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu,
vlad.pruteanu, andrei.istodorescu, luiz.dentz, Iulia Tanasescu
This patch removes unnecesary input prompts from broadcast ep register.
It also adds support to provide stream config options at broadcast
source endpoint config.
This is useful for a broadcast source supporting multiple streams,
since each stream could require a different config.
In client/player, the input prompts have been updated for broadcast
endpoint register and config: At broadcast ep register, the user will
enter the locally supported stream locations and context types.
At broacast source ep config, the user will provide the BIG that the
new stream will be part of, the stream Channel Allocation, and the
metadata of the subgroup to include the stream. These options will be
used to configure the BASE and the BIG.
Iulia Tanasescu (3):
bap: Parse BIG handle at endpoint config
shared/bap: Set bcast stream metadata
client/player: Update bcast endpoint input prompts
client/player.c | 186 ++++++++++++++++++++++++++++++++++---------
profiles/audio/bap.c | 7 +-
src/shared/bap.c | 20 +++--
3 files changed, 169 insertions(+), 44 deletions(-)
base-commit: 0de32f67f685b95c35a5c2f1206081af89bd88b6
--
2.39.2
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH BlueZ 1/3] bap: Parse BIG handle at endpoint config 2024-01-29 15:29 [PATCH BlueZ 0/3] Update bcast ep register and config props Iulia Tanasescu @ 2024-01-29 15:29 ` Iulia Tanasescu 2024-01-29 16:52 ` Update bcast ep register and config props bluez.test.bot 2024-01-29 15:29 ` [PATCH BlueZ 2/3] shared/bap: Set bcast stream metadata Iulia Tanasescu 2024-01-29 15:29 ` [PATCH BlueZ 3/3] client/player: Update bcast endpoint input prompts Iulia Tanasescu 2 siblings, 1 reply; 8+ messages in thread From: Iulia Tanasescu @ 2024-01-29 15:29 UTC (permalink / raw) To: linux-bluetooth Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu, vlad.pruteanu, andrei.istodorescu, luiz.dentz, Iulia Tanasescu This adds support to parse the "BIG" key in bcast qos parser, at endpoint configuration. --- profiles/audio/bap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 007e19f21..7faa6be7f 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -4,7 +4,7 @@ * BlueZ - Bluetooth protocol stack for Linux * * Copyright (C) 2022 Intel Corporation. All rights reserved. - * Copyright 2023 NXP + * Copyright 2023-2024 NXP * * */ @@ -610,6 +610,11 @@ static int setup_parse_bcast_qos(struct bap_setup *setup, const char *key, return -EINVAL; dbus_message_iter_get_basic(iter, &qos->bcast.encryption); + } else if (!strcasecmp(key, "BIG")) { + if (var != DBUS_TYPE_BYTE) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->bcast.big); } else if (!strcasecmp(key, "Options")) { if (var != DBUS_TYPE_BYTE) return -EINVAL; -- 2.39.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* RE: Update bcast ep register and config props 2024-01-29 15:29 ` [PATCH BlueZ 1/3] bap: Parse BIG handle at endpoint config Iulia Tanasescu @ 2024-01-29 16:52 ` bluez.test.bot 0 siblings, 0 replies; 8+ messages in thread From: bluez.test.bot @ 2024-01-29 16:52 UTC (permalink / raw) To: linux-bluetooth, iulia.tanasescu [-- Attachment #1: Type: text/plain, Size: 947 bytes --] This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=820948 ---Test result--- Test Summary: CheckPatch PASS 1.03 seconds GitLint PASS 0.68 seconds BuildEll PASS 24.02 seconds BluezMake PASS 709.31 seconds MakeCheck PASS 15.43 seconds MakeDistcheck PASS 163.99 seconds CheckValgrind PASS 226.10 seconds CheckSmatch PASS 327.51 seconds bluezmakeextell PASS 107.31 seconds IncrementalBuild PASS 2007.50 seconds ScanBuild PASS 944.40 seconds --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH BlueZ 2/3] shared/bap: Set bcast stream metadata 2024-01-29 15:29 [PATCH BlueZ 0/3] Update bcast ep register and config props Iulia Tanasescu 2024-01-29 15:29 ` [PATCH BlueZ 1/3] bap: Parse BIG handle at endpoint config Iulia Tanasescu @ 2024-01-29 15:29 ` Iulia Tanasescu 2024-01-29 15:29 ` [PATCH BlueZ 3/3] client/player: Update bcast endpoint input prompts Iulia Tanasescu 2 siblings, 0 replies; 8+ messages in thread From: Iulia Tanasescu @ 2024-01-29 15:29 UTC (permalink / raw) To: linux-bluetooth Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu, vlad.pruteanu, andrei.istodorescu, luiz.dentz, Iulia Tanasescu This updates bt_bap_stream_metadata to handle broadcast streams, by setting stream medatada. --- src/shared/bap.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 06cac5bb3..851d6a5fa 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -4,7 +4,7 @@ * BlueZ - Bluetooth protocol stack for Linux * * Copyright (C) 2022 Intel Corporation. All rights reserved. - * Copyright 2023 NXP + * Copyright 2023-2024 NXP * */ @@ -5114,13 +5114,21 @@ unsigned int bt_bap_stream_metadata(struct bt_bap_stream *stream, if (!stream) return 0; - if (!stream->client) { - stream_metadata(stream, metadata, NULL); + switch (bt_bap_stream_get_type(stream)) { + case BT_BAP_STREAM_TYPE_UCAST: + if (!stream->client) { + stream_metadata(stream, metadata, NULL); + return 0; + } + return bap_stream_metadata(stream, BT_ASCS_METADATA, + metadata, func, user_data); + case BT_BAP_STREAM_TYPE_BCAST: + util_iov_free(stream->meta, 1); + stream->meta = util_iov_dup(metadata, 1); + return 1; + default: return 0; } - - return bap_stream_metadata(stream, BT_ASCS_METADATA, metadata, func, - user_data); } unsigned int bt_bap_stream_release(struct bt_bap_stream *stream, -- 2.39.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH BlueZ 3/3] client/player: Update bcast endpoint input prompts 2024-01-29 15:29 [PATCH BlueZ 0/3] Update bcast ep register and config props Iulia Tanasescu 2024-01-29 15:29 ` [PATCH BlueZ 1/3] bap: Parse BIG handle at endpoint config Iulia Tanasescu 2024-01-29 15:29 ` [PATCH BlueZ 2/3] shared/bap: Set bcast stream metadata Iulia Tanasescu @ 2024-01-29 15:29 ` Iulia Tanasescu 2024-01-29 19:05 ` Luiz Augusto von Dentz 2024-01-29 19:11 ` Luiz Augusto von Dentz 2 siblings, 2 replies; 8+ messages in thread From: Iulia Tanasescu @ 2024-01-29 15:29 UTC (permalink / raw) To: linux-bluetooth Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu, vlad.pruteanu, andrei.istodorescu, luiz.dentz, Iulia Tanasescu This updates the input prompts for broadcast endpoint register and config. To register a broadcast endpoint, the user will be asked to enter the supported stream locations and context types. At broadcast source endpoint config, the user will provide stream config options: The BIG that the new stream will be part of, the stream Channel Allocation, and the metadata of the subgroup to include the stream. These options will be used to configure the BASE and the BIG. --- client/player.c | 186 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 149 insertions(+), 37 deletions(-) diff --git a/client/player.c b/client/player.c index 623519209..d9a4bce87 100644 --- a/client/player.c +++ b/client/player.c @@ -4,7 +4,7 @@ * BlueZ - Bluetooth protocol stack for Linux * * Copyright (C) 2020 Intel Corporation. All rights reserved. - * Copyright 2023 NXP + * Copyright 2023-2024 NXP * * */ @@ -3259,12 +3259,8 @@ static void endpoint_iso_group(const char *input, void *user_data) ep->iso_group = value; } - if (!ep->broadcast) - bt_shell_prompt_input(ep->path, "CIS (auto/value):", - endpoint_iso_stream, ep); - else - bt_shell_prompt_input(ep->path, "BIS (auto/value):", - endpoint_iso_stream, ep); + bt_shell_prompt_input(ep->path, "CIS (auto/value):", + endpoint_iso_stream, ep); } static void endpoint_context(const char *input, void *user_data) @@ -3282,12 +3278,8 @@ static void endpoint_context(const char *input, void *user_data) ep->context = value; - if (ep->broadcast) - bt_shell_prompt_input(ep->path, "BIG (auto/value):", - endpoint_iso_group, ep); - else - bt_shell_prompt_input(ep->path, "CIG (auto/value):", - endpoint_iso_group, ep); + bt_shell_prompt_input(ep->path, "CIG (auto/value):", + endpoint_iso_group, ep); } static void endpoint_supported_context(const char *input, void *user_data) @@ -3305,6 +3297,11 @@ static void endpoint_supported_context(const char *input, void *user_data) ep->supported_context = value; + if (ep->broadcast) { + endpoint_register(ep); + return; + } + bt_shell_prompt_input(ep->path, "Context (value):", endpoint_context, ep); } @@ -3354,13 +3351,6 @@ static void endpoint_auto_accept(const char *input, void *user_data) { struct endpoint *ep = user_data; - if (!strcmp(ep->uuid, BCAA_SERVICE_UUID) || - !strcmp(ep->uuid, BAA_SERVICE_UUID)) { - ep->broadcast = true; - } else { - ep->broadcast = false; - } - if (!strcasecmp(input, "y") || !strcasecmp(input, "yes")) { ep->auto_accept = true; bt_shell_prompt_input(ep->path, "Max Transports (auto/value):", @@ -3478,6 +3468,13 @@ static void cmd_register_endpoint(int argc, char *argv[]) g_list_length(local_endpoints)); local_endpoints = g_list_append(local_endpoints, ep); + if (!strcmp(ep->uuid, BCAA_SERVICE_UUID) || + !strcmp(ep->uuid, BAA_SERVICE_UUID)) { + ep->broadcast = true; + } else { + ep->broadcast = false; + } + if (strrchr(argv[2], ':')) { ep->codec = 0xff; parse_vendor_codec(argv[2], &ep->cid, &ep->vid); @@ -3626,6 +3623,134 @@ static void endpoint_config(const char *input, void *user_data) static struct endpoint *endpoint_new(const struct capabilities *cap); +static void endpoint_set_metadata_cfg(const char *input, void *user_data) +{ + struct endpoint_config *cfg = user_data; + + if (!strcasecmp(input, "n") || !strcasecmp(input, "no")) + goto done; + + if (!cfg->meta) + cfg->meta = g_new0(struct iovec, 1); + + cfg->meta->iov_base = str2bytearray((char *) input, + &cfg->meta->iov_len); + if (!cfg->meta->iov_base) { + free(cfg->meta); + cfg->meta = NULL; + } + +done: + endpoint_set_config(cfg); +} + +static void config_endpoint_channel_location(const char *input, void *user_data) +{ + struct endpoint_config *cfg = user_data; + char *endptr = NULL; + uint32_t location; + + if (!strcasecmp(input, "n") || !strcasecmp(input, "no")) + goto add_meta; + + location = strtol(input, &endptr, 0); + + if (!endptr || *endptr != '\0') { + bt_shell_printf("Invalid argument: %s\n", input); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + /* Add Channel Allocation LTV in capabilities */ + { + uint8_t ltv[6] = { 0x05, LC3_CONFIG_CHAN_ALLOC }; + + location = cpu_to_le32(location); + memcpy(<v[2], &location, sizeof(location)); + iov_append(&cfg->caps, ltv, sizeof(ltv)); + } + +add_meta: + /* Add metadata */ + bt_shell_prompt_input(cfg->ep->path, "Enter Metadata (value/no):", + endpoint_set_metadata_cfg, cfg); +} + +static void ltv_find(size_t i, uint8_t l, uint8_t t, uint8_t *v, + void *user_data) +{ + bool *found = user_data; + + *found = true; +} + +static void config_endpoint_iso_group(const char *input, void *user_data) +{ + struct endpoint_config *cfg = user_data; + char *endptr = NULL; + int value; + bool found = false; + + value = strtol(input, &endptr, 0); + + if (!endptr || *endptr != '\0' || value > UINT8_MAX) { + bt_shell_printf("Invalid argument: %s\n", input); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + cfg->ep->iso_group = value; + + /* Check if Channel Allocation is present in caps */ + { + uint8_t type = LC3_CONFIG_CHAN_ALLOC; + + util_ltv_foreach(cfg->caps->iov_base, + cfg->caps->iov_len, &type, + ltv_find, &found); + } + + /* Add Channel Allocation if it is not present in caps */ + if (!found) { + bt_shell_prompt_input(cfg->ep->path, + "Enter channel location (value/no):", + config_endpoint_channel_location, cfg); + } else { + /* Add metadata */ + bt_shell_prompt_input(cfg->ep->path, + "Enter Metadata (value/no):", + endpoint_set_metadata_cfg, cfg); + } +} + +static void endpoint_set_config_bcast(struct endpoint_config *cfg) +{ + cfg->ep->bcode = g_new0(struct iovec, 1); + iov_append(&cfg->ep->bcode, bcast_code, + sizeof(bcast_code)); + + /* Add periodic advertisement parameters */ + cfg->sync_factor = BCAST_SYNC_FACTOR; + cfg->options = BCAST_OPTIONS; + cfg->skip = BCAST_SKIP; + cfg->sync_timeout = BCAST_SYNC_TIMEOUT; + cfg->sync_cte_type = BCAST_SYNC_CTE_TYPE; + + /* Add BIG create sync parameters */ + cfg->mse = BCAST_MSE; + cfg->timeout = BCAST_TIMEOUT; + + if ((strcmp(cfg->ep->uuid, BAA_SERVICE_UUID) == 0)) { + /* A broadcast sink endpoint config does not need + * user input. + */ + endpoint_set_config(cfg); + return; + } + + bt_shell_prompt_input(cfg->ep->path, + "BIG (value):", + config_endpoint_iso_group, cfg); +} + static void cmd_config_endpoint(int argc, char *argv[]) { struct endpoint_config *cfg; @@ -3662,24 +3787,11 @@ static void cmd_config_endpoint(int argc, char *argv[]) /* Set QoS parameters */ cfg->qos = preset->qos; - if (cfg->ep->broadcast) { - cfg->ep->bcode = g_new0(struct iovec, 1); - iov_append(&cfg->ep->bcode, bcast_code, - sizeof(bcast_code)); - - /* Add periodic advertisement parameters */ - cfg->sync_factor = BCAST_SYNC_FACTOR; - cfg->options = BCAST_OPTIONS; - cfg->skip = BCAST_SKIP; - cfg->sync_timeout = BCAST_SYNC_TIMEOUT; - cfg->sync_cte_type = BCAST_SYNC_CTE_TYPE; - /* Add BIG create sync parameters */ - cfg->mse = BCAST_MSE; - cfg->timeout = BCAST_TIMEOUT; - - endpoint_set_config(cfg); - } else + if (cfg->ep->broadcast) + endpoint_set_config_bcast(cfg); + else endpoint_set_config(cfg); + return; } -- 2.39.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH BlueZ 3/3] client/player: Update bcast endpoint input prompts 2024-01-29 15:29 ` [PATCH BlueZ 3/3] client/player: Update bcast endpoint input prompts Iulia Tanasescu @ 2024-01-29 19:05 ` Luiz Augusto von Dentz 2024-01-29 19:11 ` Luiz Augusto von Dentz 1 sibling, 0 replies; 8+ messages in thread From: Luiz Augusto von Dentz @ 2024-01-29 19:05 UTC (permalink / raw) To: Iulia Tanasescu Cc: linux-bluetooth, claudia.rosu, mihai-octavian.urzica, silviu.barbulescu, vlad.pruteanu, andrei.istodorescu Hi Iulia, On Mon, Jan 29, 2024 at 10:29 AM Iulia Tanasescu <iulia.tanasescu@nxp.com> wrote: > > This updates the input prompts for broadcast endpoint register and > config. > > To register a broadcast endpoint, the user will be asked to enter > the supported stream locations and context types. > > At broadcast source endpoint config, the user will provide stream > config options: The BIG that the new stream will be part of, the > stream Channel Allocation, and the metadata of the subgroup to > include the stream. These options will be used to configure the > BASE and the BIG. Please add some samples if the changes affect user input, since this does look like it will have some impact on when BIG/BIS is requested, also make sure this works out with the likes of -e command line option, since that automatically registers endpoints. > --- > client/player.c | 186 ++++++++++++++++++++++++++++++++++++++---------- > 1 file changed, 149 insertions(+), 37 deletions(-) > > diff --git a/client/player.c b/client/player.c > index 623519209..d9a4bce87 100644 > --- a/client/player.c > +++ b/client/player.c > @@ -4,7 +4,7 @@ > * BlueZ - Bluetooth protocol stack for Linux > * > * Copyright (C) 2020 Intel Corporation. All rights reserved. > - * Copyright 2023 NXP > + * Copyright 2023-2024 NXP > * > * > */ > @@ -3259,12 +3259,8 @@ static void endpoint_iso_group(const char *input, void *user_data) > ep->iso_group = value; > } > > - if (!ep->broadcast) > - bt_shell_prompt_input(ep->path, "CIS (auto/value):", > - endpoint_iso_stream, ep); > - else > - bt_shell_prompt_input(ep->path, "BIS (auto/value):", > - endpoint_iso_stream, ep); > + bt_shell_prompt_input(ep->path, "CIS (auto/value):", > + endpoint_iso_stream, ep); > } > > static void endpoint_context(const char *input, void *user_data) > @@ -3282,12 +3278,8 @@ static void endpoint_context(const char *input, void *user_data) > > ep->context = value; > > - if (ep->broadcast) > - bt_shell_prompt_input(ep->path, "BIG (auto/value):", > - endpoint_iso_group, ep); > - else > - bt_shell_prompt_input(ep->path, "CIG (auto/value):", > - endpoint_iso_group, ep); > + bt_shell_prompt_input(ep->path, "CIG (auto/value):", > + endpoint_iso_group, ep); > } > > static void endpoint_supported_context(const char *input, void *user_data) > @@ -3305,6 +3297,11 @@ static void endpoint_supported_context(const char *input, void *user_data) > > ep->supported_context = value; > > + if (ep->broadcast) { > + endpoint_register(ep); > + return; > + } > + > bt_shell_prompt_input(ep->path, "Context (value):", endpoint_context, > ep); > } > @@ -3354,13 +3351,6 @@ static void endpoint_auto_accept(const char *input, void *user_data) > { > struct endpoint *ep = user_data; > > - if (!strcmp(ep->uuid, BCAA_SERVICE_UUID) || > - !strcmp(ep->uuid, BAA_SERVICE_UUID)) { > - ep->broadcast = true; > - } else { > - ep->broadcast = false; > - } > - > if (!strcasecmp(input, "y") || !strcasecmp(input, "yes")) { > ep->auto_accept = true; > bt_shell_prompt_input(ep->path, "Max Transports (auto/value):", > @@ -3478,6 +3468,13 @@ static void cmd_register_endpoint(int argc, char *argv[]) > g_list_length(local_endpoints)); > local_endpoints = g_list_append(local_endpoints, ep); > > + if (!strcmp(ep->uuid, BCAA_SERVICE_UUID) || > + !strcmp(ep->uuid, BAA_SERVICE_UUID)) { > + ep->broadcast = true; > + } else { > + ep->broadcast = false; > + } > + > if (strrchr(argv[2], ':')) { > ep->codec = 0xff; > parse_vendor_codec(argv[2], &ep->cid, &ep->vid); > @@ -3626,6 +3623,134 @@ static void endpoint_config(const char *input, void *user_data) > > static struct endpoint *endpoint_new(const struct capabilities *cap); > > +static void endpoint_set_metadata_cfg(const char *input, void *user_data) > +{ > + struct endpoint_config *cfg = user_data; > + > + if (!strcasecmp(input, "n") || !strcasecmp(input, "no")) > + goto done; > + > + if (!cfg->meta) > + cfg->meta = g_new0(struct iovec, 1); > + > + cfg->meta->iov_base = str2bytearray((char *) input, > + &cfg->meta->iov_len); > + if (!cfg->meta->iov_base) { > + free(cfg->meta); > + cfg->meta = NULL; > + } > + > +done: > + endpoint_set_config(cfg); > +} > + > +static void config_endpoint_channel_location(const char *input, void *user_data) > +{ > + struct endpoint_config *cfg = user_data; > + char *endptr = NULL; > + uint32_t location; > + > + if (!strcasecmp(input, "n") || !strcasecmp(input, "no")) > + goto add_meta; > + > + location = strtol(input, &endptr, 0); > + > + if (!endptr || *endptr != '\0') { > + bt_shell_printf("Invalid argument: %s\n", input); > + return bt_shell_noninteractive_quit(EXIT_FAILURE); > + } > + > + /* Add Channel Allocation LTV in capabilities */ > + { > + uint8_t ltv[6] = { 0x05, LC3_CONFIG_CHAN_ALLOC }; > + > + location = cpu_to_le32(location); > + memcpy(<v[2], &location, sizeof(location)); > + iov_append(&cfg->caps, ltv, sizeof(ltv)); > + } Not a big fan of creating scopes like above in the middle of the function, how about we have a dedicated function for setting these? > +add_meta: > + /* Add metadata */ > + bt_shell_prompt_input(cfg->ep->path, "Enter Metadata (value/no):", > + endpoint_set_metadata_cfg, cfg); > +} > + > +static void ltv_find(size_t i, uint8_t l, uint8_t t, uint8_t *v, > + void *user_data) > +{ > + bool *found = user_data; > + > + *found = true; > +} > + > +static void config_endpoint_iso_group(const char *input, void *user_data) > +{ > + struct endpoint_config *cfg = user_data; > + char *endptr = NULL; > + int value; > + bool found = false; > + > + value = strtol(input, &endptr, 0); > + > + if (!endptr || *endptr != '\0' || value > UINT8_MAX) { > + bt_shell_printf("Invalid argument: %s\n", input); > + return bt_shell_noninteractive_quit(EXIT_FAILURE); > + } > + > + cfg->ep->iso_group = value; > + > + /* Check if Channel Allocation is present in caps */ > + { > + uint8_t type = LC3_CONFIG_CHAN_ALLOC; > + > + util_ltv_foreach(cfg->caps->iov_base, > + cfg->caps->iov_len, &type, > + ltv_find, &found); > + } Ditto, just have the type defined in the beginning of the function. > + > + /* Add Channel Allocation if it is not present in caps */ > + if (!found) { > + bt_shell_prompt_input(cfg->ep->path, > + "Enter channel location (value/no):", > + config_endpoint_channel_location, cfg); > + } else { > + /* Add metadata */ > + bt_shell_prompt_input(cfg->ep->path, > + "Enter Metadata (value/no):", > + endpoint_set_metadata_cfg, cfg); > + } > +} > + > +static void endpoint_set_config_bcast(struct endpoint_config *cfg) > +{ > + cfg->ep->bcode = g_new0(struct iovec, 1); > + iov_append(&cfg->ep->bcode, bcast_code, > + sizeof(bcast_code)); > + > + /* Add periodic advertisement parameters */ > + cfg->sync_factor = BCAST_SYNC_FACTOR; > + cfg->options = BCAST_OPTIONS; > + cfg->skip = BCAST_SKIP; > + cfg->sync_timeout = BCAST_SYNC_TIMEOUT; > + cfg->sync_cte_type = BCAST_SYNC_CTE_TYPE; > + > + /* Add BIG create sync parameters */ > + cfg->mse = BCAST_MSE; > + cfg->timeout = BCAST_TIMEOUT; > + > + if ((strcmp(cfg->ep->uuid, BAA_SERVICE_UUID) == 0)) { > + /* A broadcast sink endpoint config does not need > + * user input. > + */ > + endpoint_set_config(cfg); > + return; > + } > + > + bt_shell_prompt_input(cfg->ep->path, > + "BIG (value):", > + config_endpoint_iso_group, cfg); > +} > + > static void cmd_config_endpoint(int argc, char *argv[]) > { > struct endpoint_config *cfg; > @@ -3662,24 +3787,11 @@ static void cmd_config_endpoint(int argc, char *argv[]) > /* Set QoS parameters */ > cfg->qos = preset->qos; > > - if (cfg->ep->broadcast) { > - cfg->ep->bcode = g_new0(struct iovec, 1); > - iov_append(&cfg->ep->bcode, bcast_code, > - sizeof(bcast_code)); > - > - /* Add periodic advertisement parameters */ > - cfg->sync_factor = BCAST_SYNC_FACTOR; > - cfg->options = BCAST_OPTIONS; > - cfg->skip = BCAST_SKIP; > - cfg->sync_timeout = BCAST_SYNC_TIMEOUT; > - cfg->sync_cte_type = BCAST_SYNC_CTE_TYPE; > - /* Add BIG create sync parameters */ > - cfg->mse = BCAST_MSE; > - cfg->timeout = BCAST_TIMEOUT; > - > - endpoint_set_config(cfg); > - } else > + if (cfg->ep->broadcast) > + endpoint_set_config_bcast(cfg); > + else > endpoint_set_config(cfg); > + > return; > } > > -- > 2.39.2 > -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH BlueZ 3/3] client/player: Update bcast endpoint input prompts 2024-01-29 15:29 ` [PATCH BlueZ 3/3] client/player: Update bcast endpoint input prompts Iulia Tanasescu 2024-01-29 19:05 ` Luiz Augusto von Dentz @ 2024-01-29 19:11 ` Luiz Augusto von Dentz 1 sibling, 0 replies; 8+ messages in thread From: Luiz Augusto von Dentz @ 2024-01-29 19:11 UTC (permalink / raw) To: Iulia Tanasescu Cc: linux-bluetooth, claudia.rosu, mihai-octavian.urzica, silviu.barbulescu, vlad.pruteanu, andrei.istodorescu Hi Iulia, On Mon, Jan 29, 2024 at 10:29 AM Iulia Tanasescu <iulia.tanasescu@nxp.com> wrote: > > This updates the input prompts for broadcast endpoint register and > config. > > To register a broadcast endpoint, the user will be asked to enter > the supported stream locations and context types. > > At broadcast source endpoint config, the user will provide stream > config options: The BIG that the new stream will be part of, the > stream Channel Allocation, and the metadata of the subgroup to > include the stream. These options will be used to configure the > BASE and the BIG. > --- > client/player.c | 186 ++++++++++++++++++++++++++++++++++++++---------- > 1 file changed, 149 insertions(+), 37 deletions(-) > > diff --git a/client/player.c b/client/player.c > index 623519209..d9a4bce87 100644 > --- a/client/player.c > +++ b/client/player.c > @@ -4,7 +4,7 @@ > * BlueZ - Bluetooth protocol stack for Linux > * > * Copyright (C) 2020 Intel Corporation. All rights reserved. > - * Copyright 2023 NXP > + * Copyright 2023-2024 NXP > * > * > */ > @@ -3259,12 +3259,8 @@ static void endpoint_iso_group(const char *input, void *user_data) > ep->iso_group = value; > } > > - if (!ep->broadcast) > - bt_shell_prompt_input(ep->path, "CIS (auto/value):", > - endpoint_iso_stream, ep); > - else > - bt_shell_prompt_input(ep->path, "BIS (auto/value):", > - endpoint_iso_stream, ep); > + bt_shell_prompt_input(ep->path, "CIS (auto/value):", > + endpoint_iso_stream, ep); > } > > static void endpoint_context(const char *input, void *user_data) > @@ -3282,12 +3278,8 @@ static void endpoint_context(const char *input, void *user_data) > > ep->context = value; > > - if (ep->broadcast) > - bt_shell_prompt_input(ep->path, "BIG (auto/value):", > - endpoint_iso_group, ep); > - else > - bt_shell_prompt_input(ep->path, "CIG (auto/value):", > - endpoint_iso_group, ep); > + bt_shell_prompt_input(ep->path, "CIG (auto/value):", > + endpoint_iso_group, ep); > } > > static void endpoint_supported_context(const char *input, void *user_data) > @@ -3305,6 +3297,11 @@ static void endpoint_supported_context(const char *input, void *user_data) > > ep->supported_context = value; > > + if (ep->broadcast) { > + endpoint_register(ep); > + return; > + } > + > bt_shell_prompt_input(ep->path, "Context (value):", endpoint_context, > ep); > } > @@ -3354,13 +3351,6 @@ static void endpoint_auto_accept(const char *input, void *user_data) > { > struct endpoint *ep = user_data; > > - if (!strcmp(ep->uuid, BCAA_SERVICE_UUID) || > - !strcmp(ep->uuid, BAA_SERVICE_UUID)) { > - ep->broadcast = true; > - } else { > - ep->broadcast = false; > - } > - > if (!strcasecmp(input, "y") || !strcasecmp(input, "yes")) { > ep->auto_accept = true; > bt_shell_prompt_input(ep->path, "Max Transports (auto/value):", > @@ -3478,6 +3468,13 @@ static void cmd_register_endpoint(int argc, char *argv[]) > g_list_length(local_endpoints)); > local_endpoints = g_list_append(local_endpoints, ep); > > + if (!strcmp(ep->uuid, BCAA_SERVICE_UUID) || > + !strcmp(ep->uuid, BAA_SERVICE_UUID)) { > + ep->broadcast = true; > + } else { > + ep->broadcast = false; > + } > + > if (strrchr(argv[2], ':')) { > ep->codec = 0xff; > parse_vendor_codec(argv[2], &ep->cid, &ep->vid); > @@ -3626,6 +3623,134 @@ static void endpoint_config(const char *input, void *user_data) > > static struct endpoint *endpoint_new(const struct capabilities *cap); > > +static void endpoint_set_metadata_cfg(const char *input, void *user_data) > +{ > + struct endpoint_config *cfg = user_data; > + > + if (!strcasecmp(input, "n") || !strcasecmp(input, "no")) > + goto done; > + > + if (!cfg->meta) > + cfg->meta = g_new0(struct iovec, 1); > + > + cfg->meta->iov_base = str2bytearray((char *) input, > + &cfg->meta->iov_len); > + if (!cfg->meta->iov_base) { > + free(cfg->meta); > + cfg->meta = NULL; > + } > + > +done: > + endpoint_set_config(cfg); > +} > + > +static void config_endpoint_channel_location(const char *input, void *user_data) > +{ > + struct endpoint_config *cfg = user_data; > + char *endptr = NULL; > + uint32_t location; > + > + if (!strcasecmp(input, "n") || !strcasecmp(input, "no")) > + goto add_meta; > + > + location = strtol(input, &endptr, 0); > + > + if (!endptr || *endptr != '\0') { > + bt_shell_printf("Invalid argument: %s\n", input); > + return bt_shell_noninteractive_quit(EXIT_FAILURE); > + } > + > + /* Add Channel Allocation LTV in capabilities */ > + { > + uint8_t ltv[6] = { 0x05, LC3_CONFIG_CHAN_ALLOC }; > + > + location = cpu_to_le32(location); > + memcpy(<v[2], &location, sizeof(location)); > + iov_append(&cfg->caps, ltv, sizeof(ltv)); > + } > + > +add_meta: > + /* Add metadata */ > + bt_shell_prompt_input(cfg->ep->path, "Enter Metadata (value/no):", > + endpoint_set_metadata_cfg, cfg); > +} > + > +static void ltv_find(size_t i, uint8_t l, uint8_t t, uint8_t *v, > + void *user_data) > +{ > + bool *found = user_data; > + > + *found = true; > +} > + > +static void config_endpoint_iso_group(const char *input, void *user_data) > +{ > + struct endpoint_config *cfg = user_data; > + char *endptr = NULL; > + int value; > + bool found = false; > + > + value = strtol(input, &endptr, 0); > + > + if (!endptr || *endptr != '\0' || value > UINT8_MAX) { > + bt_shell_printf("Invalid argument: %s\n", input); > + return bt_shell_noninteractive_quit(EXIT_FAILURE); > + } You seem to be removing auto support for some reason? Afaik that is sort of the normal usage since the user normally doesn't know what adv instances are available in the system, setting a fixed BIG is only really useful when doing multiple BIS/streams. > + cfg->ep->iso_group = value; > + > + /* Check if Channel Allocation is present in caps */ > + { > + uint8_t type = LC3_CONFIG_CHAN_ALLOC; > + > + util_ltv_foreach(cfg->caps->iov_base, > + cfg->caps->iov_len, &type, > + ltv_find, &found); > + } > + > + /* Add Channel Allocation if it is not present in caps */ > + if (!found) { > + bt_shell_prompt_input(cfg->ep->path, > + "Enter channel location (value/no):", > + config_endpoint_channel_location, cfg); > + } else { > + /* Add metadata */ > + bt_shell_prompt_input(cfg->ep->path, > + "Enter Metadata (value/no):", > + endpoint_set_metadata_cfg, cfg); > + } > +} > + > +static void endpoint_set_config_bcast(struct endpoint_config *cfg) > +{ > + cfg->ep->bcode = g_new0(struct iovec, 1); > + iov_append(&cfg->ep->bcode, bcast_code, > + sizeof(bcast_code)); > + > + /* Add periodic advertisement parameters */ > + cfg->sync_factor = BCAST_SYNC_FACTOR; > + cfg->options = BCAST_OPTIONS; > + cfg->skip = BCAST_SKIP; > + cfg->sync_timeout = BCAST_SYNC_TIMEOUT; > + cfg->sync_cte_type = BCAST_SYNC_CTE_TYPE; > + > + /* Add BIG create sync parameters */ > + cfg->mse = BCAST_MSE; > + cfg->timeout = BCAST_TIMEOUT; > + > + if ((strcmp(cfg->ep->uuid, BAA_SERVICE_UUID) == 0)) { > + /* A broadcast sink endpoint config does not need > + * user input. > + */ > + endpoint_set_config(cfg); > + return; > + } > + > + bt_shell_prompt_input(cfg->ep->path, > + "BIG (value):", > + config_endpoint_iso_group, cfg); > +} > + > static void cmd_config_endpoint(int argc, char *argv[]) > { > struct endpoint_config *cfg; > @@ -3662,24 +3787,11 @@ static void cmd_config_endpoint(int argc, char *argv[]) > /* Set QoS parameters */ > cfg->qos = preset->qos; > > - if (cfg->ep->broadcast) { > - cfg->ep->bcode = g_new0(struct iovec, 1); > - iov_append(&cfg->ep->bcode, bcast_code, > - sizeof(bcast_code)); > - > - /* Add periodic advertisement parameters */ > - cfg->sync_factor = BCAST_SYNC_FACTOR; > - cfg->options = BCAST_OPTIONS; > - cfg->skip = BCAST_SKIP; > - cfg->sync_timeout = BCAST_SYNC_TIMEOUT; > - cfg->sync_cte_type = BCAST_SYNC_CTE_TYPE; > - /* Add BIG create sync parameters */ > - cfg->mse = BCAST_MSE; > - cfg->timeout = BCAST_TIMEOUT; > - > - endpoint_set_config(cfg); > - } else > + if (cfg->ep->broadcast) > + endpoint_set_config_bcast(cfg); > + else > endpoint_set_config(cfg); > + > return; > } > > -- > 2.39.2 > -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH BlueZ v2 1/4] bap: Parse BIG handle at endpoint config @ 2024-01-30 15:44 Iulia Tanasescu 2024-01-30 17:48 ` Update bcast ep register and config props bluez.test.bot 0 siblings, 1 reply; 8+ messages in thread From: Iulia Tanasescu @ 2024-01-30 15:44 UTC (permalink / raw) To: linux-bluetooth Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu, vlad.pruteanu, andrei.istodorescu, luiz.dentz, Iulia Tanasescu This adds support to parse the "BIG" key in bcast qos parser, at endpoint configuration. --- profiles/audio/bap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 007e19f21..7faa6be7f 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -4,7 +4,7 @@ * BlueZ - Bluetooth protocol stack for Linux * * Copyright (C) 2022 Intel Corporation. All rights reserved. - * Copyright 2023 NXP + * Copyright 2023-2024 NXP * * */ @@ -610,6 +610,11 @@ static int setup_parse_bcast_qos(struct bap_setup *setup, const char *key, return -EINVAL; dbus_message_iter_get_basic(iter, &qos->bcast.encryption); + } else if (!strcasecmp(key, "BIG")) { + if (var != DBUS_TYPE_BYTE) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->bcast.big); } else if (!strcasecmp(key, "Options")) { if (var != DBUS_TYPE_BYTE) return -EINVAL; -- 2.39.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* RE: Update bcast ep register and config props 2024-01-30 15:44 [PATCH BlueZ v2 1/4] bap: Parse BIG handle at endpoint config Iulia Tanasescu @ 2024-01-30 17:48 ` bluez.test.bot 0 siblings, 0 replies; 8+ messages in thread From: bluez.test.bot @ 2024-01-30 17:48 UTC (permalink / raw) To: linux-bluetooth, iulia.tanasescu [-- Attachment #1: Type: text/plain, Size: 947 bytes --] This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=821345 ---Test result--- Test Summary: CheckPatch PASS 2.26 seconds GitLint PASS 1.11 seconds BuildEll PASS 24.40 seconds BluezMake PASS 770.42 seconds MakeCheck PASS 12.05 seconds MakeDistcheck PASS 168.67 seconds CheckValgrind PASS 232.61 seconds CheckSmatch PASS 336.84 seconds bluezmakeextell PASS 109.69 seconds IncrementalBuild PASS 2852.15 seconds ScanBuild PASS 981.67 seconds --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-01-30 17:48 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-01-29 15:29 [PATCH BlueZ 0/3] Update bcast ep register and config props Iulia Tanasescu 2024-01-29 15:29 ` [PATCH BlueZ 1/3] bap: Parse BIG handle at endpoint config Iulia Tanasescu 2024-01-29 16:52 ` Update bcast ep register and config props bluez.test.bot 2024-01-29 15:29 ` [PATCH BlueZ 2/3] shared/bap: Set bcast stream metadata Iulia Tanasescu 2024-01-29 15:29 ` [PATCH BlueZ 3/3] client/player: Update bcast endpoint input prompts Iulia Tanasescu 2024-01-29 19:05 ` Luiz Augusto von Dentz 2024-01-29 19:11 ` Luiz Augusto von Dentz -- strict thread matches above, loose matches on Subject: below -- 2024-01-30 15:44 [PATCH BlueZ v2 1/4] bap: Parse BIG handle at endpoint config Iulia Tanasescu 2024-01-30 17:48 ` Update bcast ep register and config props bluez.test.bot
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.