client/player: Add support for entering metadata via endpoint.presets
Luiz Augusto von Dentz
maintainerPATCH 1/4 client/player: Add support for entering metadata via endpoint.presets
From: Luiz Augusto von Dentz <[email protected]>
--- client/player.c | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-)
client/player.c +38 -8
@@ -1228,6 +1228,7 @@ static const struct capabilities {struct codec_preset {char *name;const struct iovec data; +const struct iovec meta;struct bt_bap_qos qos;uint8_t target_latency;uint32_t chan_alloc;
@@ -2069,7 +2070,10 @@ static DBusMessage *endpoint_select_properties_reply(struct endpoint *ep, }/* Copy metadata */ - cfg->meta =util_iov_dup (ep->meta,1 ); +if (preset->meta.iov_len) + cfg->meta =util_iov_dup (&preset->meta,1 ); +else + cfg->meta =util_iov_dup (ep->meta,1 );if (ep->broadcast) qos = &preset->qos.bcast.io_qos;
@@ -4205,7 +4209,8 @@ static void cmd_presets_endpoint(int argc, char *argv[])if (argc >4 ) {struct codec_preset *alt_preset; -struct iovec *iov = (void *)&default_preset->data; +struct iovec *caps = (void *)&default_preset->data; +struct iovec *meta = (void *)&default_preset->meta;/* Check if and alternative preset was given */ alt_preset =preset_find_name (preset, argv[4 ]);
@@ -4218,14 +4223,37 @@ static void cmd_presets_endpoint(int argc, char *argv[])return ; } - iov->iov_base =str2bytearray (argv[4 ], &iov->iov_len); -if (!iov->iov_base) { -bt_shell_printf ("Invalid configuration %s\n" , - argv[4 ]); -return bt_shell_noninteractive_quit ( +/* Check if Codec Configuration was entered */ +if (strlen (argv[4 ])) { + caps->iov_base =str2bytearray (argv[4 ], + &caps->iov_len); +if (!caps->iov_base) { +bt_shell_printf ("Invalid configuration " +"%s\n" , + argv[4 ]); +return bt_shell_noninteractive_quit (EXIT_FAILURE ); + } } +/* Check if metadata was entered */ +if (argc >5 ) { + meta->iov_base =str2bytearray (argv[5 ], + &meta->iov_len); +if (!meta->iov_base) { +bt_shell_printf ("Invalid metadata %s\n" , + argv[5 ]); +return bt_shell_noninteractive_quit ( +EXIT_FAILURE ); + } + } + +/* If configuration was left empty then ask the +* parameters. +*/ +if (!caps->iov_base || !caps->iov_len) + goto enter_cc; + bt_shell_prompt_input("QoS", "Enter Target Latency " "(Low, Balance, High):", custom_target_latency,
@@ -4236,6 +4264,7 @@ static void cmd_presets_endpoint(int argc, char *argv[]) }else print_presets (preset); +enter_cc:if (default_preset && default_preset->custom) {bt_shell_prompt_input ("Codec" ,"Enter frequency (Khz):" , custom_frequency, default_preset);
@@ -4265,7 +4294,8 @@ static const struct bt_shell_menu endpoint_menu = { cmd_config_endpoint,"Configure Endpoint" , endpoint_generator }, - { "presets", "<UUID> <codec[:company]> [preset] [config]", + { "presets", "<UUID> <codec[:company]> [preset] [codec config] " +"[metadata]" , cmd_presets_endpoint,"List or add presets" , uuid_generator },
Signature · 1 line
2.46.0
Luiz Augusto von Dentz
maintainerPATCH 2/4 client/player: Make endpoint.presets accept endpoint object
From: Luiz Augusto von Dentz <[email protected]>
This makes endpoint.presets accept local endpoints rather than just UUIDs:
[bluetooth]# endpoint.presets /local/endpoint/ep0 32_1_1
--- client/player.c | 65 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 20 deletions(-)
client/player.c +45 -20
@@ -118,6 +118,7 @@ struct endpoint {struct queue *transports;DBusMessage *msg;struct preset *preset; +struct codec_preset *codec_preset;bool broadcast;struct iovec *bcode; };
@@ -2101,13 +2102,23 @@ static DBusMessage *endpoint_select_properties_reply(struct endpoint *ep,return reply; } +static struct codec_preset *endpoint_find_codec_preset (struct endpoint *ep, +const char *name) +{ +if (ep->codec_preset && + (!name || !strcmp (ep->codec_preset->name, name))) +return ep->codec_preset; + +return preset_find_name (ep->preset, name); +} +static void select_properties_response (const char *input,void *user_data) {struct endpoint *ep = user_data;struct codec_preset *p;DBusMessage *reply; - p =preset_find_name (ep->preset, input); + p =endpoint_find_codec_preset (ep, input);if (p) { reply =endpoint_select_properties_reply (ep, ep->msg, p); goto done;
@@ -2149,7 +2160,7 @@ static DBusMessage *endpoint_select_properties(DBusConnection *conn,return NULL ; } - p =preset_find_name (ep->preset,NULL ); + p =endpoint_find_codec_preset (ep,NULL );if (!p)return NULL ;
@@ -4192,28 +4203,42 @@ static void cmd_presets_endpoint(int argc, char *argv[]) {struct preset *preset;struct codec_preset *default_preset =NULL ; +struct endpoint *ep =NULL ; preset =find_presets_name (argv[1 ], argv[2 ]);if (!preset) { -bt_shell_printf ("No preset found\n" ); -return bt_shell_noninteractive_quit (EXIT_FAILURE ); - } - -if (argc >3 ) { - default_preset =codec_preset_add (preset, argv[3 ]); -if (!default_preset) { -bt_shell_printf ("Preset %s not found\n" , argv[3 ]); + ep =endpoint_find (argv[1 ]); +if (!ep) { +bt_shell_printf ("No preset found\n" );return bt_shell_noninteractive_quit (EXIT_FAILURE ); } - preset->default_preset = default_preset; + preset = ep->preset; + argv++; + argc--; + }else { + argv +=2 ; + argc -=2 ; + } -if (argc >4 ) { +if (argc >1 ) { + default_preset =codec_preset_add (preset, argv[1 ]); +if (!default_preset) { +bt_shell_printf ("Preset %s not found\n" , argv[1 ]); +return bt_shell_noninteractive_quit (EXIT_FAILURE ); + } + +if (ep) + ep->codec_preset = default_preset; +else + preset->default_preset = default_preset; + +if (argc >2 ) {struct codec_preset *alt_preset;struct iovec *caps = (void *)&default_preset->data;struct iovec *meta = (void *)&default_preset->meta;/* Check if and alternative preset was given */ - alt_preset =preset_find_name (preset, argv[4 ]); + alt_preset =preset_find_name (preset, argv[2 ]);if (alt_preset) { default_preset->alt_preset = alt_preset; bt_shell_prompt_input(default_preset->name,
@@ -4224,21 +4249,21 @@ static void cmd_presets_endpoint(int argc, char *argv[]) }/* Check if Codec Configuration was entered */ -if (strlen (argv[4 ])) { - caps->iov_base =str2bytearray (argv[4 ], +if (strlen (argv[2 ])) { + caps->iov_base =str2bytearray (argv[2 ], &caps->iov_len);if (!caps->iov_base) {bt_shell_printf ("Invalid configuration " "%s\n" , - argv[4 ]); + argv[2 ]);return bt_shell_noninteractive_quit (EXIT_FAILURE ); } }/* Check if metadata was entered */ -if (argc >5 ) { - meta->iov_base =str2bytearray (argv[5 ], +if (argc >3 ) { + meta->iov_base =str2bytearray (argv[3 ], &meta->iov_len);if (!meta->iov_base) { bt_shell_printf("Invalid metadata %s\n",
@@ -4294,8 +4319,8 @@ static const struct bt_shell_menu endpoint_menu = { cmd_config_endpoint,"Configure Endpoint" , endpoint_generator }, - { "presets", "<UUID> <codec[:company]> [preset] [codec config] " -"[metadata]" , + { "presets", "<endpoint>/<UUID> [codec[:company]] [preset] " +"[codec config] [metadata]" , cmd_presets_endpoint,"List or add presets" , uuid_generator },
Signature · 1 line
2.46.0
Luiz Augusto von Dentz
maintainerPATCH 3/4 client/player: Make endpoint.show print local preset
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This makes command endpoint.show print preset set with endpoint.presets:
Quoted 1 line
endpoint.show /local/endpoint/ep2
Endpoint /local/endpoint/ep2
UUID 00002bc9-0000-1000-8000-00805f9b34fb Codec 0x06 (6) Capabilities.#0: len 0x03 type 0x01 Capabilities.Sampling Frequencies: 0x00ff Capabilities.Sampling Frequency: 8 Khz (0x0001) Capabilities.Sampling Frequency: 11.25 Khz (0x0002) Capabilities.Sampling Frequency: 16 Khz (0x0004) Capabilities.Sampling Frequency: 22.05 Khz (0x0008) Capabilities.Sampling Frequency: 24 Khz (0x0010) Capabilities.Sampling Frequency: 32 Khz (0x0020) Capabilities.Sampling Frequency: 44.1 Khz (0x0040) Capabilities.Sampling Frequency: 48 Khz (0x0080) Capabilities.#1: len 0x02 type 0x02 Capabilities.Frame Duration: 0x03 Capabilities.Frame Duration: 7.5 ms (0x01) Capabilities.Frame Duration: 10 ms (0x02) Capabilities.#2: len 0x05 type 0x04 Capabilities.Frame Length: 26 (0x001a) - 240 (0x00f0) Capabilities.#3: len 0x02 type 0x03 Capabilities.Audio Channel Count: 0x01 Capabilities.Audio Channel Count: 1 channel (0x01) Preset 32_1_1 Configuration.#0: len 0x02 type 0x01 Configuration.Sampling Frequency: 32 Khz (0x06) Configuration.#1: len 0x02 type 0x02 Configuration.Frame Duration: 7.5 ms (0x00) Configuration.#2: len 0x03 type 0x04 Configuration.Frame Length: 60 (0x003c) Locations 0x00000002 (2) --- client/player.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
client/player.c +13 -0
@@ -2797,13 +2797,26 @@ static void print_capabilities(GDBusProxy *proxy)print_codec (uuid, codec, &caps, &meta); } +static void print_preset (struct codec_preset *codec,uint8_t codec_id) +{ +bt_shell_printf ("\tPreset %s\n" , codec->name); + +if (codec_id ==LC3_ID ) +print_lc3_cfg (codec->data.iov_base, codec->data.iov_len); +} +static void print_local_endpoint (struct endpoint *ep) {bt_shell_printf ("Endpoint %s\n" , ep->path);bt_shell_printf ("\tUUID %s\n" , ep->uuid);bt_shell_printf ("\tCodec 0x%02x (%u)\n" , ep->codec, ep->codec); +if (ep->caps)print_codec (ep->uuid, ep->codec, ep->caps, ep->meta); + +if (ep->codec_preset) +print_preset (ep->codec_preset, ep->codec); +if (ep->locations)bt_shell_printf ("\tLocations 0x%08x (%u)\n" , ep->locations, ep->locations);
Signature · 1 line
2.46.0
Luiz Augusto von Dentz
maintainerPATCH 4/4 client/player: Print endpoint preset with endpoint.presets
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
If just the endpoint objects is passed to endpoint.presets then just print it instead of the listing the presets available for the UUID:
[bluetooth]# endpoint.presets /local/endpoint/ep2
Preset 32_1_1 Configuration.#0: len 0x02 type 0x01 Configuration.Sampling Frequency: 32 Khz (0x06) Configuration.#1: len 0x02 type 0x02 Configuration.Frame Duration: 7.5 ms (0x00) Configuration.#2: len 0x03 type 0x04 Configuration.Frame Length: 60 (0x003c) --- client/player.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
client/player.c +3 -1
@@ -4299,7 +4299,9 @@ static void cmd_presets_endpoint(int argc, char *argv[])return ; } - }else + }else if (ep && (ep->codec_preset)) +print_preset (ep->codec_preset, ep->codec); +else print_presets (preset); enter_cc:
Signature · 1 line
2.46.0
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=881039
---Test result---
Test Summary:
CheckPatch PASS 2.01 seconds GitLint FAIL 1.51 seconds BuildEll PASS 24.39 seconds BluezMake PASS 1649.05 seconds MakeCheck FAIL 13.71 seconds MakeDistcheck FAIL 159.68 seconds CheckValgrind FAIL 251.90 seconds CheckSmatch PASS 354.04 seconds bluezmakeextell PASS 118.51 seconds IncrementalBuild PASS 5957.59 seconds ScanBuild WARNING 997.78 seconds
Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v1,1/4] client/player: Add support for entering metadata via endpoint.presets
WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T1 Title exceeds max length (84>80): "[BlueZ,v1,1/4] client/player: Add support for entering metadata via endpoint.presets"
[BlueZ,v1,3/4] client/player: Make endpoint.show print local preset
WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
9: B3 Line contains hard tab characters (\t): " UUID 00002bc9-0000-1000-8000-00805f9b34fb"
10: B3 Line contains hard tab characters (\t): " Codec 0x06 (6)"
11: B3 Line contains hard tab characters (\t): " Capabilities.#0: len 0x03 type 0x01"
12: B3 Line contains hard tab characters (\t): " Capabilities.Sampling Frequencies: 0x00ff"
13: B3 Line contains hard tab characters (\t): " Capabilities.Sampling Frequency: 8 Khz (0x0001)"
14: B3 Line contains hard tab characters (\t): " Capabilities.Sampling Frequency: 11.25 Khz (0x0002)"
15: B3 Line contains hard tab characters (\t): " Capabilities.Sampling Frequency: 16 Khz (0x0004)"
16: B3 Line contains hard tab characters (\t): " Capabilities.Sampling Frequency: 22.05 Khz (0x0008)"
17: B3 Line contains hard tab characters (\t): " Capabilities.Sampling Frequency: 24 Khz (0x0010)"
18: B3 Line contains hard tab characters (\t): " Capabilities.Sampling Frequency: 32 Khz (0x0020)"
19: B3 Line contains hard tab characters (\t): " Capabilities.Sampling Frequency: 44.1 Khz (0x0040)"
20: B3 Line contains hard tab characters (\t): " Capabilities.Sampling Frequency: 48 Khz (0x0080)"
21: B3 Line contains hard tab characters (\t): " Capabilities.#1: len 0x02 type 0x02"
22: B3 Line contains hard tab characters (\t): " Capabilities.Frame Duration: 0x03"
23: B3 Line contains hard tab characters (\t): " Capabilities.Frame Duration: 7.5 ms (0x01)"
24: B3 Line contains hard tab characters (\t): " Capabilities.Frame Duration: 10 ms (0x02)"
25: B3 Line contains hard tab characters (\t): " Capabilities.#2: len 0x05 type 0x04"
26: B3 Line contains hard tab characters (\t): " Capabilities.Frame Length: 26 (0x001a) - 240 (0x00f0)"
27: B3 Line contains hard tab characters (\t): " Capabilities.#3: len 0x02 type 0x03"
28: B3 Line contains hard tab characters (\t): " Capabilities.Audio Channel Count: 0x01"
29: B3 Line contains hard tab characters (\t): " Capabilities.Audio Channel Count: 1 channel (0x01)"
30: B3 Line contains hard tab characters (\t): " Preset 32_1_1"
31: B3 Line contains hard tab characters (\t): " Configuration.#0: len 0x02 type 0x01"
32: B3 Line contains hard tab characters (\t): " Configuration.Sampling Frequency: 32 Khz (0x06)"
33: B3 Line contains hard tab characters (\t): " Configuration.#1: len 0x02 type 0x02"
34: B3 Line contains hard tab characters (\t): " Configuration.Frame Duration: 7.5 ms (0x00)"
35: B3 Line contains hard tab characters (\t): " Configuration.#2: len 0x03 type 0x04"
36: B3 Line contains hard tab characters (\t): " Configuration.Frame Length: 60 (0x003c)"
37: B3 Line contains hard tab characters (\t): " Locations 0x00000002 (2)"
[BlueZ,v1,4/4] client/player: Print endpoint preset with endpoint.presets
WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
9: B3 Line contains hard tab characters (\t): " Preset 32_1_1"
10: B3 Line contains hard tab characters (\t): " Configuration.#0: len 0x02 type 0x01"
11: B3 Line contains hard tab characters (\t): " Configuration.Sampling Frequency: 32 Khz (0x06)"
12: B3 Line contains hard tab characters (\t): " Configuration.#1: len 0x02 type 0x02"
13: B3 Line contains hard tab characters (\t): " Configuration.Frame Duration: 7.5 ms (0x00)"
14: B3 Line contains hard tab characters (\t): " Configuration.#2: len 0x03 type 0x04"
15: B3 Line contains hard tab characters (\t): " Configuration.Frame Length: 60 (0x003c)"
##############################
Test: MakeCheck - FAIL
Desc: Run Bluez Make Check
Output:
make[3]: *** [Makefile:11764: test-suite.log] Error 1 make[2]: *** [Makefile:11872: check-TESTS] Error 2 make[1]: *** [Makefile:12301: check-am] Error 2
make: *** [Makefile:12303: check] Error 2
##############################
Test: MakeDistcheck - FAIL
Desc: Run Bluez Make Distcheck
Output:
Package cups was not found in the pkg-config search path. Perhaps you should add the directory containing `cups.pc' to the PKG_CONFIG_PATH environment variable
No package 'cups' found
make[4]: *** [Makefile:11764: test-suite.log] Error 1 make[3]: *** [Makefile:11872: check-TESTS] Error 2 make[2]: *** [Makefile:12301: check-am] Error 2 make[1]: *** [Makefile:12303: check] Error 2
make: *** [Makefile:12224: distcheck] Error 1
##############################
Test: CheckValgrind - FAIL
Desc: Run Bluez Make Check with Valgrind
Output:
tools/mgmt-tester.c: In function ‘main’:tools/mgmt-tester.c:12725:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12725 | int main(int argc, char *argv[])
| ^~~~
make[3]: *** [Makefile:11764: test-suite.log] Error 1
make[2]: *** [Makefile:11872: check-TESTS] Error 2
make[1]: *** [Makefile:12301: check-am] Error 2
make: *** [Makefile:12303: check] Error 2
##############################
Test: ScanBuild - WARNING
Desc: Run Scan Build
Output:client/player.c:2206:8: warning: Null pointer passed to 2nd parameter expecting 'nonnull'
if (!strcmp(ep->path, pattern))
^~~~~~~~~~~~~~~~~~~~~~~~~
client/player.c:3454:16: warning: Null pointer passed to 1st parameter expecting 'nonnull'
codec->name = strdup(name);
^~~~~~~~~~~~2 warnings generated.
---
Regards,
Linux Bluetooth
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 5 lines · On Mon, 19 Aug 2024 15:50:59 -0400 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
--- client/player.c | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-)
Here is the summary with links:
- [BlueZ,v1,1/4] client/player: Add support for entering metadata via endpoint.presets
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=b35d0a45baf2 - [BlueZ,v1,2/4] client/player: Make endpoint.presets accept endpoint object https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=a59529d3bac6 - [BlueZ,v1,3/4] client/player: Make endpoint.show print local preset https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=c909433ed23b - [BlueZ,v1,4/4] client/player: Print endpoint preset with endpoint.presets https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=168ea3078066
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html