iso-tester: Add tests for GMAP broadcast QoS presets
Luiz Augusto von Dentz
maintainerPATCH v2 1/3 iso-tester: Add tests for GMAP broadcast QoS presets
From: Luiz Augusto von Dentz <[email protected]>
This adds the following tests:
ISO QoS 48_1_g - Success
ISO QoS 48_2_g - Success
ISO QoS 48_3_g - Success
ISO QoS 48_4_g - Success
--- tools/iso-tester.c | 133 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 118 insertions(+), 15 deletions(-)
tools/iso-tester.c +118 -15
@@ -307,22 +307,81 @@#define QOS_OUT_1_1_16_2_1 BCAST_QOS_OUT_1_1(10000, 10, 40, 0x02, 2)#define QOS_IN_16_2_1 BCAST_QOS_IN(10000, 10, 40, 0x02, 2)#define QOS_IN_ENC_16_2_1 BCAST_QOS_IN_ENC(10000, 10, 40, 0x02, 2) +#define QOS_OUT_48_1_g BCAST_QOS_OUT(7500, 8, 75, 0x02, 1) +#define QOS_OUT_48_2_g BCAST_QOS_OUT(10000, 10, 100, 0x02, 1) +#define QOS_OUT_48_3_g BCAST_QOS_OUT(7500, 8, 90, 0x02, 1) +#define QOS_OUT_48_4_g BCAST_QOS_OUT(10000, 10, 120, 0x02, 1) -static const uint8_t base_lc3_16_2_1[] = { -0x28 ,0x00 ,0x00 ,/* Presentation Delay */ -0x01 ,/* Number of Subgroups */ -0x01 ,/* Number of BIS */ -0x06 ,0x00 ,0x00 ,0x00 ,0x00 ,/* Code ID = LC3 (0x06) */ -0x11 ,/* Codec Specific Configuration */ -0x02 ,0x01 ,0x03 ,/* 16 KHZ */ -0x02 ,0x02 ,0x01 ,/* 10 ms */ -0x05 ,0x03 ,0x01 ,0x00 ,0x00 ,0x00 ,/* Front Left */ -0x03 ,0x04 ,0x28 ,0x00 ,/* Frame Length 40 bytes */ -0x04 ,/* Metadata */ -0x03 ,0x02 ,0x02 ,0x00 ,/* Audio Context: Convertional */ -0x01 ,/* BIS */ -0x00 ,/* Codec Specific Configuration */ -}; +#define BASE(_pd, _sgrp, _nbis, _cfg...) \ +{ \ + _pd & 0xff, _pd >> 8, _pd >> 16, \ + _sgrp, \ + _nbis, \ + _cfg \ +} + +#define LC3_BASE(_pd, _sgrp, _nbis, _cc...) \ + BASE(_pd, _sgrp, _nbis, 0x06, 0x00, 0x00, 0x00, 0x00, _cc) + +/* 16 KHZ - 10 ms - Front Left - Frame Length 40 bytes */ +#define LC3_CONFIG_16_2_1 \ + 0x10, \ + 0x02, 0x01, 0x03, \ + 0x02, 0x02, 0x01, \ + 0x05, 0x03, 0x01, 0x00, 0x00, 0x00, \ + 0x03, 0x04, 0x28, 0x00 + +/* Audio Context: Convertional */ +#define CTXT_CONVERSIONAL \ + 0x04, \ + 0x03, 0x02, 0x02, 0x00 + +static const uint8_t base_lc3_16_2_1[] = +LC3_BASE (40000 ,1 ,1 ,LC3_CONFIG_16_2_1 ,CTXT_CONVERSIONAL , +0x01 ,/* BIS */ +0x00 /* Codec Specific Configuration */ ); + +#define LC3_CONFIG_G (_freq, _dur, _len) \ + 0x0a, \ + 0x02, 0x01, _freq, \ + 0x02, 0x02, _dur, \ + 0x03, 0x04, _len, _len >> 8 + +#define LC3_CONFIG_FRONT_LEFT \ + 0x06, \ + 0x05, 0x03, 0x01, 0x00, 0x00, 0x00 + +/* 48 KHZ - 7.5 ms - Frame Length 75 bytes */ +#define LC3_CONFIG_48_1_G \ + LC3_CONFIG_G(0x08, 0x00, 75) + +static const uint8_t base_lc3_48_1_g[] = +LC3_BASE (10000 ,1 ,1 ,LC3_CONFIG_48_1_G ,CTXT_CONVERSIONAL , +0x01 ,LC3_CONFIG_FRONT_LEFT ); + +/* 48 KHZ - 10 ms Frame Length 100 bytes */ +#define LC3_CONFIG_48_2_G \ + LC3_CONFIG_G(0x08, 0x01, 100) + +static const uint8_t base_lc3_48_2_g[] = +LC3_BASE (10000 ,1 ,1 ,LC3_CONFIG_48_2_G ,CTXT_CONVERSIONAL , +0x01 ,LC3_CONFIG_FRONT_LEFT ); + +/* 48 KHZ - 7.5 ms Frame Length 90 bytes */ +#define LC3_CONFIG_48_3_G \ + LC3_CONFIG_G(0x08, 0x00, 90) + +static const uint8_t base_lc3_48_3_g[] = +LC3_BASE (10000 ,1 ,1 ,LC3_CONFIG_48_3_G ,CTXT_CONVERSIONAL , +0x01 ,LC3_CONFIG_FRONT_LEFT ); + +/* 48 KHZ - 7.5 ms Frame Length 90 bytes */ +#define LC3_CONFIG_48_4_G \ + LC3_CONFIG_G(0x08, 0x00, 120) + +static const uint8_t base_lc3_48_4_g[] = +LC3_BASE (10000 ,1 ,1 ,LC3_CONFIG_48_3_G ,CTXT_CONVERSIONAL , +0x01 ,LC3_CONFIG_FRONT_LEFT );/* Single Audio Channel. One BIS. */ #define BCAST_AC_12 BCAST_QOS_OUT_1_1(10000, 10, 40, 0x02, 2)
@@ -1166,6 +1225,38 @@ static const struct iso_client_data connect_ac_1_2_cig_1_2 = { .mconn = true, }; +static const struct iso_client_data bcast_48_1_g = { + .qos = QOS_OUT_48_1_g, + .expect_err =0 , + .bcast = true, + .base = base_lc3_48_1_g, + .base_len =sizeof (base_lc3_48_1_g), +}; + +static const struct iso_client_data bcast_48_2_g = { + .qos = QOS_OUT_48_2_g, + .expect_err =0 , + .bcast = true, + .base = base_lc3_48_2_g, + .base_len =sizeof (base_lc3_48_2_g), +}; + +static const struct iso_client_data bcast_48_3_g = { + .qos = QOS_OUT_48_3_g, + .expect_err =0 , + .bcast = true, + .base = base_lc3_48_3_g, + .base_len =sizeof (base_lc3_48_3_g), +}; + +static const struct iso_client_data bcast_48_4_g = { + .qos = QOS_OUT_48_4_g, + .expect_err =0 , + .bcast = true, + .base = base_lc3_48_4_g, + .base_len =sizeof (base_lc3_48_4_g), +}; +static const struct iso_client_data bcast_16_2_1_send = { .qos =QOS_OUT_16_2_1 , .expect_err =0 ,
@@ -3054,6 +3145,18 @@ int main(int argc, char *argv[])test_iso ("ISO QoS 48_4_gr - Success" , &connect_48_4_gr, setup_powered, test_connect); +test_iso ("ISO QoS 48_1_g - Success" , &bcast_48_1_g, + setup_powered, test_bcast); + +test_iso ("ISO QoS 48_2_g - Success" , &bcast_48_2_g, + setup_powered, test_bcast); + +test_iso ("ISO QoS 48_3_g - Success" , &bcast_48_3_g, + setup_powered, test_bcast); + +test_iso ("ISO QoS 48_4_g - Success" , &bcast_48_4_g, + setup_powered, test_bcast); +test_iso ("ISO QoS - Invalid" , &connect_invalid, setup_powered, test_connect);
Signature · 1 line
2.43.0
Luiz Augusto von Dentz
maintainerPATCH v2 2/3 util: Make debugger arg of util_debug_ltv const
From: Luiz Augusto von Dentz <[email protected]>
This makes the debugger argument of util_debug_ltv const as they are not suppose to change during its call.
--- src/shared/bap-debug.c | 6 +++--- src/shared/util.c | 10 +++++----- src/shared/util.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-)
src/shared/bap-debug.c +3 -3
@@ -184,7 +184,7 @@ done: user_data); } -struct util_ltv_debugger pac_cap_table[] = { +static const struct util_ltv_debugger pac_cap_table[] = {UTIL_LTV_DEBUG (0x01 , pac_debug_freq),UTIL_LTV_DEBUG (0x02 , pac_debug_duration),UTIL_LTV_DEBUG (0x03 , pac_debug_channels),
@@ -413,7 +413,7 @@ done: user_data); } -struct util_ltv_debugger ase_cc_table[] = { +static const struct util_ltv_debugger ase_cc_table[] = {UTIL_LTV_DEBUG (0x01 , ase_debug_freq),UTIL_LTV_DEBUG (0x02 , ase_debug_duration),UTIL_LTV_DEBUG (0x03 , ase_debug_location),
@@ -527,7 +527,7 @@ done: user_data); } -struct util_ltv_debugger ase_metadata_table[] = { +static const struct util_ltv_debugger ase_metadata_table[] = {UTIL_LTV_DEBUG (0x01 , ase_debug_preferred_context),UTIL_LTV_DEBUG (0x02 , ase_debug_context),UTIL_LTV_DEBUG (0x03 , ase_debug_program_info),
src/shared/util.c +5 -5
@@ -157,8 +157,8 @@ uint64_t util_debug_bit(const char *label, uint64_t val,return mask; } -static struct util_ltv_debugger * -ltv_debugger (struct util_ltv_debugger *debugger,size_t num,uint8_t type) +static const struct util_ltv_debugger * +ltv_debugger (const struct util_ltv_debugger *debugger,size_t num,uint8_t type) {size_t i;
@@ -166,7 +166,7 @@ ltv_debugger(struct util_ltv_debugger *debugger, size_t num, uint8_t type)return NULL ;for (i =0 ; i < num; i++) { -struct util_ltv_debugger *debug = &debugger[i]; +const struct util_ltv_debugger *debug = &debugger[i];if (debug->type == type)return debug;
@@ -177,7 +177,7 @@ ltv_debugger(struct util_ltv_debugger *debugger, size_t num, uint8_t type)/* Helper to print debug information of LTV entries */ bool util_debug_ltv (const uint8_t *data,uint8_t len, -struct util_ltv_debugger *debugger,size_t num, +const struct util_ltv_debugger *debugger,size_t num,util_debug_func_t function,void *user_data) {struct iovec iov;
@@ -188,7 +188,7 @@ bool util_debug_ltv(const uint8_t *data, uint8_t len,for (i =0 ; iov.iov_len; i++) {uint8_t l, t, *v; -struct util_ltv_debugger *debug; +const struct util_ltv_debugger *debug;if (!util_iov_pull_u8 (&iov, &l)) { util_debug(function, user_data,
src/shared/util.h +1 -1
@@ -135,7 +135,7 @@ struct util_ltv_debugger { };bool util_debug_ltv (const uint8_t *data,uint8_t len, -struct util_ltv_debugger *debugger,size_t num, +const struct util_ltv_debugger *debugger,size_t num,util_debug_func_t function,void *user_data);unsigned char util_get_dt (const char *parent,const char *name);
Signature · 1 line
2.43.0
Luiz Augusto von Dentz
maintainerPATCH v2 3/3 monitor: Add proper decoding of TLV for BASE
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This uses bt_bap_debug_{config, metadata} to decode the TLV entries found in Basic Audio Announcement:
< HCI Command: LE Set Peri.. (0x08|0x003f) plen 41
Handle: 1
Operation: Complete ext advertising data (0x03)
Data length: 0x26
Service Data: Basic Audio Announcement (0x1851)
Presetation Delay: 10000
Number of Subgroups: 1
Subgroup #0:
Number of BIS(s): 1
Codec: LC3 (0x06)
Codec Specific Configuration: #0: len 0x02 type 0x01
Codec Specific Configuration: Sampling Frequency: 48 Khz (0x08)
Codec Specific Configuration: #1: len 0x02 type 0x02
Codec Specific Configuration: Frame Duration: 7.5 ms (0x00)
Codec Specific Configuration: #2: len 0x03 type 0x04
Codec Specific Configuration: Frame Length: 75 (0x004b)
Metadata: #0: len 0x03 type 0x02
Metadata: Context: 0x0002
Metadata: Context Conversational (0x0002)
BIS #0:
Index: 1
Codec Specific Configuration: #0: len 0x05 type 0x03
Codec Specific Configuration: Location: 0x00000001
Codec Specific Configuration: Location: Front Left (0x00000001)
---
monitor/packet.c | 49 +++++++++++++++++++-----------------------------
1 file changed, 19 insertions(+), 30 deletions(-)monitor/packet.c +19 -30
@@ -35,6 +35,7 @@#include "src/shared/util.h" #include "src/shared/btsnoop.h" #include "src/shared/queue.h" +#include "src/shared/bap-debug.h" #include "display.h" #include "bt.h" #include "ll.h"
@@ -3405,20 +3406,6 @@ static void print_uuid128_list(const char *label, const void *data, } } -static void *iov_pull (struct iovec *iov,size_t len) -{ -void *data; - -if (iov->iov_len < len) -return NULL ; - - data = iov->iov_base; - iov->iov_base += len; - iov->iov_len -= len; - -return data; -} -static void print_ltv (const char *str,void *user_data) {const char *label = user_data;
@@ -3435,7 +3422,7 @@ static void print_base_annoucement(const uint8_t *data, uint8_t data_len) iov.iov_base = (void *) data; iov.iov_len = data_len; - base_data =iov_pull (&iov,sizeof (*base_data)); + base_data =util_iov_pull_mem (&iov,sizeof (*base_data));if (!base_data) goto done;
@@ -3453,7 +3440,7 @@ static void print_base_annoucement(const uint8_t *data, uint8_t data_len)print_field (" Subgroup #%u:" , i); - subgroup =iov_pull (&iov,sizeof (*subgroup)); + subgroup =util_iov_pull_mem (&iov,sizeof (*subgroup));if (!subgroup) goto done;
@@ -3470,29 +3457,31 @@ static void print_base_annoucement(const uint8_t *data, uint8_t data_len) subgroup->codec.vid); } - codec_cfg =iov_pull (&iov,sizeof (*codec_cfg)); + codec_cfg =util_iov_pull_mem (&iov,sizeof (*codec_cfg));if (!codec_cfg) goto done; -if (!iov_pull (&iov, codec_cfg->len)) +if (!util_iov_pull_mem (&iov, codec_cfg->len)) goto done; label =" Codec Specific Configuration" ; -util_debug_ltv (codec_cfg->data, codec_cfg->len,NULL ,0 , - print_ltv, (void *)label); +bt_bap_debug_config (codec_cfg->data, codec_cfg->len, + print_ltv, (void *)label); - metadata =iov_pull (&iov,sizeof (*metadata)); + metadata =util_iov_pull_mem (&iov,sizeof (*metadata));if (!metadata) goto done; -if (!iov_pull (&iov, metadata->len)) +if (!util_iov_pull (&iov, metadata->len)) goto done; label =" Metadata" ; -util_debug_ltv (metadata->data, metadata->len,NULL ,0 , - print_ltv, (void *)label); +bt_bap_debug_metadata (metadata->data, metadata->len, + print_ltv, (void *)label); + + label =" Codec Specific Configuration" ;/* Level 3 - BIS(s)*/ for (j =0 ; j < subgroup->num_bis; j++) {
@@ -3500,21 +3489,21 @@ static void print_base_annoucement(const uint8_t *data, uint8_t data_len)print_field (" BIS #%u:" , j); - bis =iov_pull (&iov,sizeof (*bis)); + bis =util_iov_pull_mem (&iov,sizeof (*bis));if (!bis) goto done;print_field (" Index: %u" , bis->index); - codec_cfg =iov_pull (&iov,sizeof (*codec_cfg)); + codec_cfg =util_iov_pull_mem (&iov,sizeof (*codec_cfg));if (!codec_cfg) goto done; -if (!iov_pull (&iov, codec_cfg->len)) +if (!util_iov_pull (&iov, codec_cfg->len)) goto done; -print_hex_field (" Codec Specific Configuration" , - codec_cfg->data, codec_cfg->len); +bt_bap_debug_config (codec_cfg->data, codec_cfg->len, + print_ltv, (void *)label); } }
@@ -10443,7 +10432,7 @@ static void num_completed_packets_evt(struct timeval *tv, uint16_t index,const struct bt_hci_evt_num_completed_packets *evt = data;int i; -iov_pull (&iov,1 ); +util_iov_pull (&iov,1 );print_field ("Num handles: %d" , evt->num_handles);
Signature · 1 line
2.43.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=804915
---Test result---
Test Summary:
CheckPatch FAIL 1.21 seconds GitLint FAIL 0.84 seconds BuildEll PASS 24.36 seconds BluezMake PASS 583.93 seconds MakeCheck PASS 11.02 seconds MakeDistcheck PASS 150.40 seconds CheckValgrind PASS 211.14 seconds CheckSmatch WARNING 324.86 seconds bluezmakeextell PASS 98.70 seconds IncrementalBuild PASS 1588.70 seconds ScanBuild PASS 952.09 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,v2,3/3] monitor: Add proper decoding of TLV for BASE WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #100:
Codec Specific Configuration: Location: Front Left (0x00000001)
/github/workspace/src/src/13471360.patch total: 0 errors, 1 warnings, 116 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13471360.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v2,3/3] monitor: Add proper decoding of TLV for BASE
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
26: B3 Line contains hard tab characters (\t): " Metadata: Context Conversational (0x0002)"
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:monitor/packet.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c:1860:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3606:52: warning: array of flexible structuresmonitor/bt.h:3594:40: warning: array of flexible structures
---
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 10 lines · On Tue, 28 Nov 2023 10:28:30 -0500 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
This adds the following tests:
ISO QoS 48_1_g - Success
ISO QoS 48_2_g - Success
ISO QoS 48_3_g - Success
ISO QoS 48_4_g - Success[...]
Here is the summary with links:
- [BlueZ,v2,1/3] iso-tester: Add tests for GMAP broadcast QoS presets
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=2ba614813971 - [BlueZ,v2,2/3] util: Make debugger arg of util_debug_ltv const https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=acaf8f866d29 - [BlueZ,v2,3/3] monitor: Add proper decoding of TLV for BASE https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=c9a1f2080828
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html