Skip to content

Commit 0239a2c

Browse files
Andries Kruithofcarlescufi
authored andcommitted
tests: Bluetooth: update unittests for Audio codecs
An LE controller shall no longer support HCI_Read_Local_Supported_Codecs [v1] The code in subsys/bluetooth/controller was updated for this behaviour, and this commit updates the unittest Signed-off-by: Andries Kruithof <[email protected]>
1 parent 1200fd9 commit 0239a2c

File tree

1 file changed

+8
-42
lines changed
  • tests/bluetooth/hci_codecs_info/src

1 file changed

+8
-42
lines changed

tests/bluetooth/hci_codecs_info/src/main.c

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -52,57 +52,23 @@ ZTEST_SUITE(test_hci_codecs_info, NULL, NULL, NULL, NULL, NULL);
5252

5353
ZTEST(test_hci_codecs_info, test_read_codecs)
5454
{
55-
const struct bt_hci_rp_read_codecs *codecs;
5655
struct net_buf *rsp;
57-
uint8_t num_std_codecs;
58-
uint8_t num_vs_codecs;
59-
const uint8_t *ptr;
60-
uint8_t i;
6156
int err;
6257

6358
/* Initialize bluetooth subsystem */
6459
bt_enable(NULL);
6560

66-
/* Read Local Supported Codecs */
67-
err = bt_hci_cmd_send_sync(BT_HCI_OP_READ_CODECS, NULL, &rsp);
68-
zassert_equal(err, 0, "Reading local supported codecs failed");
69-
70-
/* Check returned data */
71-
codecs = (struct bt_hci_rp_read_codecs *)rsp->data;
72-
zassert_equal(codecs->status, 0,
73-
"Reading local supported codecs status failed");
74-
75-
ptr = (uint8_t *)&codecs->status + sizeof(codecs->status);
76-
num_std_codecs = *ptr++;
77-
zassert_equal(num_std_codecs, NUM_STD_CODECS,
78-
"Reading std codecs count failed");
79-
80-
for (i = 0; i < num_std_codecs; i++) {
81-
const struct bt_hci_std_codec_info *codec;
82-
83-
codec = (const struct bt_hci_std_codec_info *)ptr;
84-
ptr += sizeof(*codec);
85-
zassert_equal(codec->codec_id, std_codecs[i].codec_id,
86-
"Reading std codecs codec_id %d failed", i);
87-
}
61+
/*
62+
* An LE controller shall no longer support
63+
* HCI_Read_Local_Supported_Codecs [v1]
64+
* according to BT Core 5.3.
65+
*/
8866

89-
num_vs_codecs = *ptr++;
90-
zassert_equal(num_vs_codecs, NUM_VS_CODECS,
91-
"Reading vendor codecs count failed");
92-
for (i = 0; i < num_vs_codecs; i++) {
93-
const struct bt_hci_vs_codec_info *codec;
9467

95-
codec = (const struct bt_hci_vs_codec_info *)ptr;
96-
ptr += sizeof(*codec);
97-
zassert_equal(codec->company_id,
98-
sys_cpu_to_le16(vs_codecs[i].company_id),
99-
"Reading vendor codecs company_id %d failed", i);
100-
zassert_equal(codec->codec_id,
101-
sys_cpu_to_le16(vs_codecs[i].codec_id),
102-
"Reading vendor codecs codec_id %d failed", i);
103-
}
68+
/* Read Local Supported Codecs */
69+
err = bt_hci_cmd_send_sync(BT_HCI_OP_READ_CODECS, NULL, &rsp);
70+
zassert_not_equal(err, 0, "Reading local supported codecs failed");
10471

105-
net_buf_unref(rsp);
10672
}
10773

10874
ZTEST(test_hci_codecs_info, test_read_codecs_v2)

0 commit comments

Comments
 (0)