* [BlueZ PATCH 0/1] shared/bap: add ASE Control Point error responses @ 2026-06-02 8:29 raghu447 2026-06-02 8:29 ` [BlueZ PATCH 1/1] " raghu447 2026-06-02 14:53 ` [BlueZ PATCH 0/1] " Luiz Augusto von Dentz 0 siblings, 2 replies; 14+ messages in thread From: raghu447 @ 2026-06-02 8:29 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghu447 This patch adds the responses that are expected by PTS. These changes are requited to Pass PTS tests BAP/USR/SPE/BI-01[5]-C. raghavendra (1): shared/bap: add ASE Control Point error responses src/shared/bap.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 76 insertions(+), 2 deletions(-) ^ permalink raw reply [flat|nested] 14+ messages in thread
* [BlueZ PATCH 1/1] shared/bap: add ASE Control Point error responses 2026-06-02 8:29 [BlueZ PATCH 0/1] shared/bap: add ASE Control Point error responses raghu447 @ 2026-06-02 8:29 ` raghu447 2026-06-02 11:51 ` bluez.test.bot 2026-06-02 15:01 ` [BlueZ PATCH 1/1] " Luiz Augusto von Dentz 2026-06-02 14:53 ` [BlueZ PATCH 0/1] " Luiz Augusto von Dentz 1 sibling, 2 replies; 14+ messages in thread From: raghu447 @ 2026-06-02 8:29 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghavendra From: raghavendra <raghavendra.rao@collabora.com> These changes are required to Pass BAP/USR/SPE/BI-01[5]-C tests. --- src/shared/bap.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 76 insertions(+), 2 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 8fc2fb14d..ce56efbb2 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -3304,6 +3304,33 @@ static uint8_t stream_enable(struct bt_bap_stream *stream, struct iovec *meta, return 0; } +static bool ascs_metadata_rsp(struct bt_bap_endpoint *ep, struct iovec *meta, + struct iovec *rsp) +{ + struct bt_ltv *ltv; + uint16_t context; + + ltv = meta->iov_base; + if (meta->iov_len >= sizeof(*ltv) && ltv->type == 0xfc) { + ascs_ase_rsp_add(rsp, ep->id, + BT_ASCS_RSP_METADATA_UNSUPPORTED, ltv->type); + return true; + } + + if (meta->iov_len >= sizeof(*ltv) + sizeof(context) && + ltv->type == 0x02 && ltv->len == 0x03) { + context = get_le16(ltv->value); + if (!context || (context & 0xf000)) { + ascs_ase_rsp_add(rsp, ep->id, + BT_ASCS_RSP_METADATA_INVALID, + ltv->type); + return true; + } + } + + return false; +} + static uint8_t ep_enable(struct bt_bap_endpoint *ep, struct bt_bap *bap, struct bt_ascs_enable *req, struct iovec *iov, struct iovec *rsp) @@ -3335,6 +3362,9 @@ static uint8_t ep_enable(struct bt_bap_endpoint *ep, struct bt_bap *bap, return 0; } + if (ascs_metadata_rsp(ep, &meta, rsp)) + return 0; + if (!ep->stream) { DBG(bap, "No stream found"); ascs_ase_rsp_add(rsp, ep->id, @@ -3568,6 +3598,9 @@ static uint8_t ep_metadata(struct bt_bap_endpoint *ep, meta.iov_base = util_iov_pull_mem(iov, req->len); meta.iov_len = req->len; + if (ascs_metadata_rsp(ep, &meta, rsp)) + return 0; + return stream_metadata(ep->stream, &meta, rsp); } @@ -3673,6 +3706,23 @@ static struct iovec *ascs_ase_cp_rsp_new(uint8_t op) return iov; } +static void ascs_ase_cp_rsp_add_truncated(struct iovec *rsp) +{ + ascs_ase_rsp_add_errno(rsp, 0x00, -ENOMSG); +} + +static bool ascs_ase_cp_rsp_invalid_len(uint8_t op, size_t len, uint8_t num) +{ + switch (op) { + case BT_ASCS_METADATA: + return len == num; + case BT_ASCS_RELEASE: + return true; + default: + return false; + } +} + static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, unsigned int id, uint16_t offset, const uint8_t *value, size_t len, @@ -3697,7 +3747,7 @@ static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, return; } - if (len < sizeof(*hdr)) { + if (!len) { DBG(bap, "invalid len %u < %u sizeof(*hdr)", len, sizeof(*hdr)); gatt_db_attribute_write_result(attrib, id, @@ -3705,9 +3755,26 @@ static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, return; } + if (len < sizeof(*hdr)) { + DBG(bap, "invalid len %u < %u sizeof(*hdr)", len, + sizeof(*hdr)); + + rsp = ascs_ase_cp_rsp_new(value[0]); + ascs_ase_cp_rsp_add_truncated(rsp); + ret = 0; + goto respond; + } + hdr = util_iov_pull_mem(&iov, sizeof(*hdr)); rsp = ascs_ase_cp_rsp_new(hdr->op); + if (!hdr->num) { + DBG(bap, "invalid Number_of_ASEs 0"); + ascs_ase_cp_rsp_add_truncated(rsp); + ret = 0; + goto respond; + } + for (handler = handlers; handler && handler->str; handler++) { if (handler->op != hdr->op) continue; @@ -3716,7 +3783,14 @@ static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, DBG(bap, "invalid len %u < %u " "hdr->num * handler->size", len, hdr->num * handler->size); - ret = BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN; + + if (ascs_ase_cp_rsp_invalid_len(hdr->op, iov.iov_len, + hdr->num)) { + ascs_ase_cp_rsp_add_truncated(rsp); + ret = 0; + } else + ret = BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN; + goto respond; } ^ permalink raw reply related [flat|nested] 14+ messages in thread
* RE: shared/bap: add ASE Control Point error responses 2026-06-02 8:29 ` [BlueZ PATCH 1/1] " raghu447 @ 2026-06-02 11:51 ` bluez.test.bot 2026-06-02 15:01 ` [BlueZ PATCH 1/1] " Luiz Augusto von Dentz 1 sibling, 0 replies; 14+ messages in thread From: bluez.test.bot @ 2026-06-02 11:51 UTC (permalink / raw) To: linux-bluetooth, raghavendra.rao [-- Attachment #1: Type: text/plain, Size: 1600 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=1104482 ---Test result--- Test Summary: CheckPatch PASS 0.39 seconds GitLint PASS 0.41 seconds BuildEll PASS 20.94 seconds BluezMake PASS 623.38 seconds MakeCheck PASS 12.76 seconds MakeDistcheck PASS 238.26 seconds CheckValgrind PASS 259.12 seconds CheckSmatch WARNING 327.43 seconds bluezmakeextell PASS 166.33 seconds IncrementalBuild PASS 617.45 seconds ScanBuild PASS 933.99 seconds Details ############################## Test: CheckSmatch - WARNING Desc: Run smatch tool with source Output: src/shared/bap.c:312:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:312:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:312:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures https://github.com/bluez/bluez/pull/2166 --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [BlueZ PATCH 1/1] shared/bap: add ASE Control Point error responses 2026-06-02 8:29 ` [BlueZ PATCH 1/1] " raghu447 2026-06-02 11:51 ` bluez.test.bot @ 2026-06-02 15:01 ` Luiz Augusto von Dentz 2026-06-04 5:20 ` [BlueZ PATCH v2 0/1] " raghu447 1 sibling, 1 reply; 14+ messages in thread From: Luiz Augusto von Dentz @ 2026-06-02 15:01 UTC (permalink / raw) To: raghu447; +Cc: linux-bluetooth Hi Raghu, On Tue, Jun 2, 2026 at 4:35 AM raghu447 <raghavendra.rao@collabora.com> wrote: > > From: raghavendra <raghavendra.rao@collabora.com> > > These changes are required to Pass BAP/USR/SPE/BI-01[5]-C tests. > --- > src/shared/bap.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 76 insertions(+), 2 deletions(-) > > diff --git a/src/shared/bap.c b/src/shared/bap.c > index 8fc2fb14d..ce56efbb2 100644 > --- a/src/shared/bap.c > +++ b/src/shared/bap.c > @@ -3304,6 +3304,33 @@ static uint8_t stream_enable(struct bt_bap_stream *stream, struct iovec *meta, > return 0; > } > > +static bool ascs_metadata_rsp(struct bt_bap_endpoint *ep, struct iovec *meta, > + struct iovec *rsp) > +{ > + struct bt_ltv *ltv; > + uint16_t context; > + > + ltv = meta->iov_base; > + if (meta->iov_len >= sizeof(*ltv) && ltv->type == 0xfc) { What is this for? Why is it checking for type 0xfc? > + ascs_ase_rsp_add(rsp, ep->id, > + BT_ASCS_RSP_METADATA_UNSUPPORTED, ltv->type); > + return true; > + } > + > + if (meta->iov_len >= sizeof(*ltv) + sizeof(context) && > + ltv->type == 0x02 && ltv->len == 0x03) { > + context = get_le16(ltv->value); > + if (!context || (context & 0xf000)) { > + ascs_ase_rsp_add(rsp, ep->id, > + BT_ASCS_RSP_METADATA_INVALID, > + ltv->type); This seems to check if the metadata is a context and then checks if it's setting undefined bits. I'm not sure if this will age well, though, because the moment any of those bits are defined, this check will become invalid. Perhaps the intent is to check if the context is set to a value outside the supported contexts, in which case it should be rejected? But then we shouldn't hardcode 0xf000, instead we should probably use something like: ~supported_context. > + return true; > + } > + } > + > + return false; > +} > + > static uint8_t ep_enable(struct bt_bap_endpoint *ep, struct bt_bap *bap, > struct bt_ascs_enable *req, struct iovec *iov, > struct iovec *rsp) > @@ -3335,6 +3362,9 @@ static uint8_t ep_enable(struct bt_bap_endpoint *ep, struct bt_bap *bap, > return 0; > } > > + if (ascs_metadata_rsp(ep, &meta, rsp)) > + return 0; > + > if (!ep->stream) { > DBG(bap, "No stream found"); > ascs_ase_rsp_add(rsp, ep->id, > @@ -3568,6 +3598,9 @@ static uint8_t ep_metadata(struct bt_bap_endpoint *ep, > meta.iov_base = util_iov_pull_mem(iov, req->len); > meta.iov_len = req->len; > > + if (ascs_metadata_rsp(ep, &meta, rsp)) > + return 0; > + > return stream_metadata(ep->stream, &meta, rsp); > } > > @@ -3673,6 +3706,23 @@ static struct iovec *ascs_ase_cp_rsp_new(uint8_t op) > return iov; > } > > +static void ascs_ase_cp_rsp_add_truncated(struct iovec *rsp) > +{ > + ascs_ase_rsp_add_errno(rsp, 0x00, -ENOMSG); > +} > + > +static bool ascs_ase_cp_rsp_invalid_len(uint8_t op, size_t len, uint8_t num) > +{ > + switch (op) { > + case BT_ASCS_METADATA: > + return len == num; > + case BT_ASCS_RELEASE: > + return true; > + default: > + return false; > + } > +} > + > static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, > unsigned int id, uint16_t offset, > const uint8_t *value, size_t len, > @@ -3697,7 +3747,7 @@ static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, > return; > } > > - if (len < sizeof(*hdr)) { > + if (!len) { > DBG(bap, "invalid len %u < %u sizeof(*hdr)", len, > sizeof(*hdr)); > gatt_db_attribute_write_result(attrib, id, > @@ -3705,9 +3755,26 @@ static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, > return; > } > > + if (len < sizeof(*hdr)) { > + DBG(bap, "invalid len %u < %u sizeof(*hdr)", len, > + sizeof(*hdr)); > + > + rsp = ascs_ase_cp_rsp_new(value[0]); > + ascs_ase_cp_rsp_add_truncated(rsp); > + ret = 0; > + goto respond; > + } > + > hdr = util_iov_pull_mem(&iov, sizeof(*hdr)); > rsp = ascs_ase_cp_rsp_new(hdr->op); > > + if (!hdr->num) { > + DBG(bap, "invalid Number_of_ASEs 0"); > + ascs_ase_cp_rsp_add_truncated(rsp); > + ret = 0; > + goto respond; > + } > + > for (handler = handlers; handler && handler->str; handler++) { > if (handler->op != hdr->op) > continue; > @@ -3716,7 +3783,14 @@ static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, > DBG(bap, "invalid len %u < %u " > "hdr->num * handler->size", len, > hdr->num * handler->size); > - ret = BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN; > + > + if (ascs_ase_cp_rsp_invalid_len(hdr->op, iov.iov_len, > + hdr->num)) { > + ascs_ase_cp_rsp_add_truncated(rsp); > + ret = 0; > + } else > + ret = BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN; > + > goto respond; > } > > -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 14+ messages in thread
* [BlueZ PATCH v2 0/1] shared/bap: add ASE Control Point error responses 2026-06-02 15:01 ` [BlueZ PATCH 1/1] " Luiz Augusto von Dentz @ 2026-06-04 5:20 ` raghu447 2026-06-04 5:20 ` [BlueZ PATCH v2 1/1] " raghu447 0 siblings, 1 reply; 14+ messages in thread From: raghu447 @ 2026-06-04 5:20 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghu447 This patch adds the responses that are expected by PTS. This patch adds the SPE unit tests. These changes are required to Pass PTS tests BAP/USR/SPE/BI-01[5]-C. raghavendra (1): shared/bap: add ASE Control Point error responses src/shared/bap.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++-- unit/test-bap.c | 64 ++++++++++++++++++++++++++++++++++ 2 files changed, 152 insertions(+), 2 deletions(-) ^ permalink raw reply [flat|nested] 14+ messages in thread
* [BlueZ PATCH v2 1/1] shared/bap: add ASE Control Point error responses 2026-06-04 5:20 ` [BlueZ PATCH v2 0/1] " raghu447 @ 2026-06-04 5:20 ` raghu447 2026-06-04 9:02 ` bluez.test.bot 2026-06-04 14:56 ` [BlueZ PATCH v2 1/1] " Luiz Augusto von Dentz 0 siblings, 2 replies; 14+ messages in thread From: raghu447 @ 2026-06-04 5:20 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghavendra From: raghavendra <raghavendra.rao@collabora.com> Add SPE unit tests. These changes are required to Pass BAP/USR/SPE/BI-01[5]-C tests. --- src/shared/bap.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++-- unit/test-bap.c | 64 ++++++++++++++++++++++++++++++++++ 2 files changed, 152 insertions(+), 2 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 8fc2fb14d..edb84efca 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -57,6 +57,11 @@ (1<<BAP_DURATION_LTV_TYPE)|\ (1<<BAP_FRAME_LEN_LTV_TYPE)) +#define BAP_METADATA_PREF_CONTEXT_LTV_TYPE 0x01 +#define BAP_METADATA_CONTEXT_LTV_TYPE 0x02 +#define BAP_METADATA_PROGRAM_INFO_LTV_TYPE 0x03 +#define BAP_METADATA_LANGUAGE_LTV_TYPE 0x04 + struct bt_bap_pac_changed { unsigned int id; bt_bap_pac_func_t added; @@ -3304,6 +3309,40 @@ static uint8_t stream_enable(struct bt_bap_stream *stream, struct iovec *meta, return 0; } +static bool ascs_metadata_rsp(struct bt_bap_endpoint *ep, struct iovec *meta, + struct iovec *rsp) +{ + struct bt_ltv *ltv; + uint16_t supported_context = 0; + uint16_t context; + + if (ep->stream && ep->stream->lpac) + supported_context = ep->stream->lpac->qos.supported_context; + + ltv = meta->iov_base; + if (meta->iov_len >= sizeof(*ltv) && + (ltv->type < BAP_METADATA_PREF_CONTEXT_LTV_TYPE || + ltv->type > BAP_METADATA_LANGUAGE_LTV_TYPE)) { + ascs_ase_rsp_add(rsp, ep->id, + BT_ASCS_RSP_METADATA_UNSUPPORTED, ltv->type); + return true; + } + + if (meta->iov_len >= sizeof(*ltv) + sizeof(context) && + ltv->type == BAP_METADATA_CONTEXT_LTV_TYPE && + ltv->len == sizeof(context) + 1) { + context = get_le16(ltv->value); + if (!context || (context & ~supported_context)) { + ascs_ase_rsp_add(rsp, ep->id, + BT_ASCS_RSP_METADATA_INVALID, + ltv->type); + return true; + } + } + + return false; +} + static uint8_t ep_enable(struct bt_bap_endpoint *ep, struct bt_bap *bap, struct bt_ascs_enable *req, struct iovec *iov, struct iovec *rsp) @@ -3335,6 +3374,9 @@ static uint8_t ep_enable(struct bt_bap_endpoint *ep, struct bt_bap *bap, return 0; } + if (ascs_metadata_rsp(ep, &meta, rsp)) + return 0; + if (!ep->stream) { DBG(bap, "No stream found"); ascs_ase_rsp_add(rsp, ep->id, @@ -3568,6 +3610,9 @@ static uint8_t ep_metadata(struct bt_bap_endpoint *ep, meta.iov_base = util_iov_pull_mem(iov, req->len); meta.iov_len = req->len; + if (ascs_metadata_rsp(ep, &meta, rsp)) + return 0; + return stream_metadata(ep->stream, &meta, rsp); } @@ -3673,6 +3718,23 @@ static struct iovec *ascs_ase_cp_rsp_new(uint8_t op) return iov; } +static void ascs_ase_cp_rsp_add_truncated(struct iovec *rsp) +{ + ascs_ase_rsp_add_errno(rsp, 0x00, -ENOMSG); +} + +static bool ascs_ase_cp_rsp_invalid_len(uint8_t op, size_t len, uint8_t num) +{ + switch (op) { + case BT_ASCS_METADATA: + return len == num; + case BT_ASCS_RELEASE: + return true; + default: + return false; + } +} + static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, unsigned int id, uint16_t offset, const uint8_t *value, size_t len, @@ -3697,7 +3759,7 @@ static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, return; } - if (len < sizeof(*hdr)) { + if (!len) { DBG(bap, "invalid len %u < %u sizeof(*hdr)", len, sizeof(*hdr)); gatt_db_attribute_write_result(attrib, id, @@ -3705,9 +3767,26 @@ static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, return; } + if (len < sizeof(*hdr)) { + DBG(bap, "invalid len %u < %u sizeof(*hdr)", len, + sizeof(*hdr)); + + rsp = ascs_ase_cp_rsp_new(value[0]); + ascs_ase_cp_rsp_add_truncated(rsp); + ret = 0; + goto respond; + } + hdr = util_iov_pull_mem(&iov, sizeof(*hdr)); rsp = ascs_ase_cp_rsp_new(hdr->op); + if (!hdr->num) { + DBG(bap, "invalid Number_of_ASEs 0"); + ascs_ase_cp_rsp_add_truncated(rsp); + ret = 0; + goto respond; + } + for (handler = handlers; handler && handler->str; handler++) { if (handler->op != hdr->op) continue; @@ -3716,7 +3795,14 @@ static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, DBG(bap, "invalid len %u < %u " "hdr->num * handler->size", len, hdr->num * handler->size); - ret = BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN; + + if (ascs_ase_cp_rsp_invalid_len(hdr->op, iov.iov_len, + hdr->num)) { + ascs_ase_cp_rsp_add_truncated(rsp); + ret = 0; + } else + ret = BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN; + goto respond; } diff --git a/unit/test-bap.c b/unit/test-bap.c index 3a67e7016..e43d1d2ef 100644 --- a/unit/test-bap.c +++ b/unit/test-bap.c @@ -4349,6 +4349,69 @@ static void test_scc_metadata(void) test_usr_scc_metadata(); } +#define ASE_CP_RSP(_op, _ase, _code, _reason) \ + IOV_DATA(0x1b, CP_HND, _op, 0x01, _ase, _code, _reason) + +#define ASE_CP_RSP_TRUNCATED(_op) \ + IOV_DATA(0x1b, CP_HND, _op, 0xff, 0x00, 0x02, 0x00) + +#define SPE_CP_TRUNCATED(_op) \ + IOV_DATA(0x52, CP_HND, _op), \ + ASE_CP_RSP_TRUNCATED(_op) + +#define SPE_CP_ZERO_ASES(_op) \ + IOV_DATA(0x52, CP_HND, _op, 0x00), \ + ASE_CP_RSP_TRUNCATED(_op) + +#define SPE_METADATA_TRUNCATED(_ase) \ + IOV_DATA(0x52, CP_HND, 0x07, 0x01, _ase), \ + ASE_CP_RSP_TRUNCATED(0x07) + +#define SPE_METADATA_UNSUPPORTED(_ase) \ + SCC_SRC_ENABLE, \ + IOV_DATA(0x52, CP_HND, 0x07, 0x01, _ase, 0x02, 0x01, 0xfc), \ + ASE_CP_RSP(0x07, _ase, 0x0a, 0xfc) + +#define SPE_METADATA_INVALID_CONTEXT(_ase) \ + SCC_SRC_ENABLE, \ + IOV_DATA(0x52, CP_HND, 0x07, 0x01, _ase, 0x04, 0x03, 0x02, \ + 0x00, 0x10), \ + ASE_CP_RSP(0x07, _ase, 0x0c, 0x02) + +/* Unicast Server Rejects Invalid ASE Control Point Procedures + * + * Test Purpose: + * Verify the behavior of a Unicast Server IUT when a Unicast Client writes + * invalid ASE Control Point parameters. + * + * Pass verdict: + * The IUT sends a notification of the ASE Control Point characteristic with + * the expected Response_Code and Reason values. + */ +static void test_usr_spe(void) +{ + define_test("BAP/USR/SPE/BI-01-C [USR ASE Control Point truncated]", + test_setup_server, test_server, NULL, + SPE_CP_TRUNCATED(0x03)); + define_test("BAP/USR/SPE/BI-02-C [USR ASE Control Point zero ASEs]", + test_setup_server, test_server, NULL, + SPE_CP_ZERO_ASES(0x03)); + define_test("BAP/USR/SPE/BI-03-C [USR Update Metadata truncated]", + test_setup_server, test_server, NULL, + SPE_METADATA_TRUNCATED(SRC_ID(0))); + define_test("BAP/USR/SPE/BI-04-C [USR Update Metadata unsupported]", + test_setup_server, test_server, &cfg_src_enable, + SPE_METADATA_UNSUPPORTED(SRC_ID(0))); + define_test("BAP/USR/SPE/BI-05-C [USR Update Metadata invalid context]", + test_setup_server, test_server, &cfg_src_enable, + SPE_METADATA_INVALID_CONTEXT(SRC_ID(0))); +} + +static void test_spe(void) +{ + test_usr_spe(); +} + #define SNK_ENABLE \ IOV_DATA(0x52, 0x22, 0x00, 0x03, 0x01, 0x01, 0x04, 0x03, 0x02, 0x01, \ 00), \ @@ -10259,6 +10322,7 @@ int main(int argc, char *argv[]) tester_init(&argc, &argv); test_disc(); + test_spe(); test_scc(); test_bsrc_scc(); test_bsnk_scc(); ^ permalink raw reply related [flat|nested] 14+ messages in thread
* RE: shared/bap: add ASE Control Point error responses 2026-06-04 5:20 ` [BlueZ PATCH v2 1/1] " raghu447 @ 2026-06-04 9:02 ` bluez.test.bot 2026-06-04 14:56 ` [BlueZ PATCH v2 1/1] " Luiz Augusto von Dentz 1 sibling, 0 replies; 14+ messages in thread From: bluez.test.bot @ 2026-06-04 9:02 UTC (permalink / raw) To: linux-bluetooth, raghavendra.rao [-- Attachment #1: Type: text/plain, Size: 1600 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=1105699 ---Test result--- Test Summary: CheckPatch PASS 0.57 seconds GitLint PASS 0.33 seconds BuildEll PASS 20.05 seconds BluezMake PASS 612.41 seconds MakeCheck PASS 19.18 seconds MakeDistcheck PASS 234.26 seconds CheckValgrind PASS 274.34 seconds CheckSmatch WARNING 322.83 seconds bluezmakeextell PASS 165.13 seconds IncrementalBuild PASS 609.37 seconds ScanBuild PASS 919.20 seconds Details ############################## Test: CheckSmatch - WARNING Desc: Run smatch tool with source Output: src/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures https://github.com/bluez/bluez/pull/2174 --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [BlueZ PATCH v2 1/1] shared/bap: add ASE Control Point error responses 2026-06-04 5:20 ` [BlueZ PATCH v2 1/1] " raghu447 2026-06-04 9:02 ` bluez.test.bot @ 2026-06-04 14:56 ` Luiz Augusto von Dentz 2026-06-09 10:25 ` [BlueZ PATCH v3 0/2] " raghu447 1 sibling, 1 reply; 14+ messages in thread From: Luiz Augusto von Dentz @ 2026-06-04 14:56 UTC (permalink / raw) To: raghu447; +Cc: linux-bluetooth Hi Raghu, On Thu, Jun 4, 2026 at 1:21 AM raghu447 <raghavendra.rao@collabora.com> wrote: > > From: raghavendra <raghavendra.rao@collabora.com> > > Add SPE unit tests. > These changes are required to Pass BAP/USR/SPE/BI-01[5]-C tests. > --- > src/shared/bap.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++-- > unit/test-bap.c | 64 ++++++++++++++++++++++++++++++++++ Please split these into 2 separate commits, one for shared/bap and another for the test-bap and add the tests in the commit description of the second. > 2 files changed, 152 insertions(+), 2 deletions(-) > > diff --git a/src/shared/bap.c b/src/shared/bap.c > index 8fc2fb14d..edb84efca 100644 > --- a/src/shared/bap.c > +++ b/src/shared/bap.c > @@ -57,6 +57,11 @@ > (1<<BAP_DURATION_LTV_TYPE)|\ > (1<<BAP_FRAME_LEN_LTV_TYPE)) > > +#define BAP_METADATA_PREF_CONTEXT_LTV_TYPE 0x01 > +#define BAP_METADATA_CONTEXT_LTV_TYPE 0x02 > +#define BAP_METADATA_PROGRAM_INFO_LTV_TYPE 0x03 > +#define BAP_METADATA_LANGUAGE_LTV_TYPE 0x04 > + > struct bt_bap_pac_changed { > unsigned int id; > bt_bap_pac_func_t added; > @@ -3304,6 +3309,40 @@ static uint8_t stream_enable(struct bt_bap_stream *stream, struct iovec *meta, > return 0; > } > > +static bool ascs_metadata_rsp(struct bt_bap_endpoint *ep, struct iovec *meta, > + struct iovec *rsp) > +{ > + struct bt_ltv *ltv; > + uint16_t supported_context = 0; > + uint16_t context; > + > + if (ep->stream && ep->stream->lpac) > + supported_context = ep->stream->lpac->qos.supported_context; > + > + ltv = meta->iov_base; > + if (meta->iov_len >= sizeof(*ltv) && > + (ltv->type < BAP_METADATA_PREF_CONTEXT_LTV_TYPE || > + ltv->type > BAP_METADATA_LANGUAGE_LTV_TYPE)) { > + ascs_ase_rsp_add(rsp, ep->id, > + BT_ASCS_RSP_METADATA_UNSUPPORTED, ltv->type); > + return true; > + } > + > + if (meta->iov_len >= sizeof(*ltv) + sizeof(context) && > + ltv->type == BAP_METADATA_CONTEXT_LTV_TYPE && > + ltv->len == sizeof(context) + 1) { > + context = get_le16(ltv->value); > + if (!context || (context & ~supported_context)) { > + ascs_ase_rsp_add(rsp, ep->id, > + BT_ASCS_RSP_METADATA_INVALID, > + ltv->type); > + return true; > + } > + } > + > + return false; > +} > + > static uint8_t ep_enable(struct bt_bap_endpoint *ep, struct bt_bap *bap, > struct bt_ascs_enable *req, struct iovec *iov, > struct iovec *rsp) > @@ -3335,6 +3374,9 @@ static uint8_t ep_enable(struct bt_bap_endpoint *ep, struct bt_bap *bap, > return 0; > } > > + if (ascs_metadata_rsp(ep, &meta, rsp)) > + return 0; > + > if (!ep->stream) { > DBG(bap, "No stream found"); > ascs_ase_rsp_add(rsp, ep->id, > @@ -3568,6 +3610,9 @@ static uint8_t ep_metadata(struct bt_bap_endpoint *ep, > meta.iov_base = util_iov_pull_mem(iov, req->len); > meta.iov_len = req->len; > > + if (ascs_metadata_rsp(ep, &meta, rsp)) > + return 0; > + > return stream_metadata(ep->stream, &meta, rsp); > } > > @@ -3673,6 +3718,23 @@ static struct iovec *ascs_ase_cp_rsp_new(uint8_t op) > return iov; > } > > +static void ascs_ase_cp_rsp_add_truncated(struct iovec *rsp) > +{ > + ascs_ase_rsp_add_errno(rsp, 0x00, -ENOMSG); > +} > + > +static bool ascs_ase_cp_rsp_invalid_len(uint8_t op, size_t len, uint8_t num) > +{ > + switch (op) { > + case BT_ASCS_METADATA: > + return len == num; > + case BT_ASCS_RELEASE: > + return true; > + default: > + return false; > + } > +} > + > static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, > unsigned int id, uint16_t offset, > const uint8_t *value, size_t len, > @@ -3697,7 +3759,7 @@ static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, > return; > } > > - if (len < sizeof(*hdr)) { > + if (!len) { > DBG(bap, "invalid len %u < %u sizeof(*hdr)", len, > sizeof(*hdr)); > gatt_db_attribute_write_result(attrib, id, > @@ -3705,9 +3767,26 @@ static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, > return; > } > > + if (len < sizeof(*hdr)) { > + DBG(bap, "invalid len %u < %u sizeof(*hdr)", len, > + sizeof(*hdr)); > + > + rsp = ascs_ase_cp_rsp_new(value[0]); > + ascs_ase_cp_rsp_add_truncated(rsp); > + ret = 0; > + goto respond; > + } > + > hdr = util_iov_pull_mem(&iov, sizeof(*hdr)); > rsp = ascs_ase_cp_rsp_new(hdr->op); > > + if (!hdr->num) { > + DBG(bap, "invalid Number_of_ASEs 0"); > + ascs_ase_cp_rsp_add_truncated(rsp); > + ret = 0; > + goto respond; > + } > + > for (handler = handlers; handler && handler->str; handler++) { > if (handler->op != hdr->op) > continue; > @@ -3716,7 +3795,14 @@ static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, > DBG(bap, "invalid len %u < %u " > "hdr->num * handler->size", len, > hdr->num * handler->size); > - ret = BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN; > + > + if (ascs_ase_cp_rsp_invalid_len(hdr->op, iov.iov_len, > + hdr->num)) { > + ascs_ase_cp_rsp_add_truncated(rsp); > + ret = 0; > + } else > + ret = BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN; > + > goto respond; > } > > diff --git a/unit/test-bap.c b/unit/test-bap.c > index 3a67e7016..e43d1d2ef 100644 > --- a/unit/test-bap.c > +++ b/unit/test-bap.c > @@ -4349,6 +4349,69 @@ static void test_scc_metadata(void) > test_usr_scc_metadata(); > } > > +#define ASE_CP_RSP(_op, _ase, _code, _reason) \ > + IOV_DATA(0x1b, CP_HND, _op, 0x01, _ase, _code, _reason) > + > +#define ASE_CP_RSP_TRUNCATED(_op) \ > + IOV_DATA(0x1b, CP_HND, _op, 0xff, 0x00, 0x02, 0x00) > + > +#define SPE_CP_TRUNCATED(_op) \ > + IOV_DATA(0x52, CP_HND, _op), \ > + ASE_CP_RSP_TRUNCATED(_op) > + > +#define SPE_CP_ZERO_ASES(_op) \ > + IOV_DATA(0x52, CP_HND, _op, 0x00), \ > + ASE_CP_RSP_TRUNCATED(_op) > + > +#define SPE_METADATA_TRUNCATED(_ase) \ > + IOV_DATA(0x52, CP_HND, 0x07, 0x01, _ase), \ > + ASE_CP_RSP_TRUNCATED(0x07) > + > +#define SPE_METADATA_UNSUPPORTED(_ase) \ > + SCC_SRC_ENABLE, \ > + IOV_DATA(0x52, CP_HND, 0x07, 0x01, _ase, 0x02, 0x01, 0xfc), \ > + ASE_CP_RSP(0x07, _ase, 0x0a, 0xfc) > + > +#define SPE_METADATA_INVALID_CONTEXT(_ase) \ > + SCC_SRC_ENABLE, \ > + IOV_DATA(0x52, CP_HND, 0x07, 0x01, _ase, 0x04, 0x03, 0x02, \ > + 0x00, 0x10), \ > + ASE_CP_RSP(0x07, _ase, 0x0c, 0x02) > + > +/* Unicast Server Rejects Invalid ASE Control Point Procedures > + * > + * Test Purpose: > + * Verify the behavior of a Unicast Server IUT when a Unicast Client writes > + * invalid ASE Control Point parameters. > + * > + * Pass verdict: > + * The IUT sends a notification of the ASE Control Point characteristic with > + * the expected Response_Code and Reason values. > + */ > +static void test_usr_spe(void) > +{ > + define_test("BAP/USR/SPE/BI-01-C [USR ASE Control Point truncated]", > + test_setup_server, test_server, NULL, > + SPE_CP_TRUNCATED(0x03)); > + define_test("BAP/USR/SPE/BI-02-C [USR ASE Control Point zero ASEs]", > + test_setup_server, test_server, NULL, > + SPE_CP_ZERO_ASES(0x03)); > + define_test("BAP/USR/SPE/BI-03-C [USR Update Metadata truncated]", > + test_setup_server, test_server, NULL, > + SPE_METADATA_TRUNCATED(SRC_ID(0))); > + define_test("BAP/USR/SPE/BI-04-C [USR Update Metadata unsupported]", > + test_setup_server, test_server, &cfg_src_enable, > + SPE_METADATA_UNSUPPORTED(SRC_ID(0))); > + define_test("BAP/USR/SPE/BI-05-C [USR Update Metadata invalid context]", > + test_setup_server, test_server, &cfg_src_enable, > + SPE_METADATA_INVALID_CONTEXT(SRC_ID(0))); > +} > + > +static void test_spe(void) > +{ > + test_usr_spe(); > +} > + > #define SNK_ENABLE \ > IOV_DATA(0x52, 0x22, 0x00, 0x03, 0x01, 0x01, 0x04, 0x03, 0x02, 0x01, \ > 00), \ > @@ -10259,6 +10322,7 @@ int main(int argc, char *argv[]) > tester_init(&argc, &argv); > > test_disc(); > + test_spe(); > test_scc(); > test_bsrc_scc(); > test_bsnk_scc(); > -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 14+ messages in thread
* [BlueZ PATCH v3 0/2] shared/bap: add ASE Control Point error responses 2026-06-04 14:56 ` [BlueZ PATCH v2 1/1] " Luiz Augusto von Dentz @ 2026-06-09 10:25 ` raghu447 2026-06-09 10:25 ` [BlueZ PATCH v3 1/2] " raghu447 ` (2 more replies) 0 siblings, 3 replies; 14+ messages in thread From: raghu447 @ 2026-06-09 10:25 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghu447 Added bap unit tests in a seperate patch. These changes are required to Pass BAP/USR/SPE/BI-01[5]-C tests. raghu447 (2): shared/bap: add ASE Control Point error responses unit/bap: add SPE tests src/shared/bap.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++-- unit/test-bap.c | 64 ++++++++++++++++++++++++++++++++++ 2 files changed, 152 insertions(+), 2 deletions(-) ^ permalink raw reply [flat|nested] 14+ messages in thread
* [BlueZ PATCH v3 1/2] shared/bap: add ASE Control Point error responses 2026-06-09 10:25 ` [BlueZ PATCH v3 0/2] " raghu447 @ 2026-06-09 10:25 ` raghu447 2026-06-09 12:48 ` bluez.test.bot 2026-06-09 10:25 ` [BlueZ PATCH v3 2/2] unit/bap: add SPE tests raghu447 2026-06-09 15:20 ` [BlueZ PATCH v3 0/2] shared/bap: add ASE Control Point error responses patchwork-bot+bluetooth 2 siblings, 1 reply; 14+ messages in thread From: raghu447 @ 2026-06-09 10:25 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghu447 These changes are required to Pass BAP/USR/SPE/BI-01[5]-C tests. --- src/shared/bap.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 88 insertions(+), 2 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 8fc2fb14d..edb84efca 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -57,6 +57,11 @@ (1<<BAP_DURATION_LTV_TYPE)|\ (1<<BAP_FRAME_LEN_LTV_TYPE)) +#define BAP_METADATA_PREF_CONTEXT_LTV_TYPE 0x01 +#define BAP_METADATA_CONTEXT_LTV_TYPE 0x02 +#define BAP_METADATA_PROGRAM_INFO_LTV_TYPE 0x03 +#define BAP_METADATA_LANGUAGE_LTV_TYPE 0x04 + struct bt_bap_pac_changed { unsigned int id; bt_bap_pac_func_t added; @@ -3304,6 +3309,40 @@ static uint8_t stream_enable(struct bt_bap_stream *stream, struct iovec *meta, return 0; } +static bool ascs_metadata_rsp(struct bt_bap_endpoint *ep, struct iovec *meta, + struct iovec *rsp) +{ + struct bt_ltv *ltv; + uint16_t supported_context = 0; + uint16_t context; + + if (ep->stream && ep->stream->lpac) + supported_context = ep->stream->lpac->qos.supported_context; + + ltv = meta->iov_base; + if (meta->iov_len >= sizeof(*ltv) && + (ltv->type < BAP_METADATA_PREF_CONTEXT_LTV_TYPE || + ltv->type > BAP_METADATA_LANGUAGE_LTV_TYPE)) { + ascs_ase_rsp_add(rsp, ep->id, + BT_ASCS_RSP_METADATA_UNSUPPORTED, ltv->type); + return true; + } + + if (meta->iov_len >= sizeof(*ltv) + sizeof(context) && + ltv->type == BAP_METADATA_CONTEXT_LTV_TYPE && + ltv->len == sizeof(context) + 1) { + context = get_le16(ltv->value); + if (!context || (context & ~supported_context)) { + ascs_ase_rsp_add(rsp, ep->id, + BT_ASCS_RSP_METADATA_INVALID, + ltv->type); + return true; + } + } + + return false; +} + static uint8_t ep_enable(struct bt_bap_endpoint *ep, struct bt_bap *bap, struct bt_ascs_enable *req, struct iovec *iov, struct iovec *rsp) @@ -3335,6 +3374,9 @@ static uint8_t ep_enable(struct bt_bap_endpoint *ep, struct bt_bap *bap, return 0; } + if (ascs_metadata_rsp(ep, &meta, rsp)) + return 0; + if (!ep->stream) { DBG(bap, "No stream found"); ascs_ase_rsp_add(rsp, ep->id, @@ -3568,6 +3610,9 @@ static uint8_t ep_metadata(struct bt_bap_endpoint *ep, meta.iov_base = util_iov_pull_mem(iov, req->len); meta.iov_len = req->len; + if (ascs_metadata_rsp(ep, &meta, rsp)) + return 0; + return stream_metadata(ep->stream, &meta, rsp); } @@ -3673,6 +3718,23 @@ static struct iovec *ascs_ase_cp_rsp_new(uint8_t op) return iov; } +static void ascs_ase_cp_rsp_add_truncated(struct iovec *rsp) +{ + ascs_ase_rsp_add_errno(rsp, 0x00, -ENOMSG); +} + +static bool ascs_ase_cp_rsp_invalid_len(uint8_t op, size_t len, uint8_t num) +{ + switch (op) { + case BT_ASCS_METADATA: + return len == num; + case BT_ASCS_RELEASE: + return true; + default: + return false; + } +} + static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, unsigned int id, uint16_t offset, const uint8_t *value, size_t len, @@ -3697,7 +3759,7 @@ static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, return; } - if (len < sizeof(*hdr)) { + if (!len) { DBG(bap, "invalid len %u < %u sizeof(*hdr)", len, sizeof(*hdr)); gatt_db_attribute_write_result(attrib, id, @@ -3705,9 +3767,26 @@ static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, return; } + if (len < sizeof(*hdr)) { + DBG(bap, "invalid len %u < %u sizeof(*hdr)", len, + sizeof(*hdr)); + + rsp = ascs_ase_cp_rsp_new(value[0]); + ascs_ase_cp_rsp_add_truncated(rsp); + ret = 0; + goto respond; + } + hdr = util_iov_pull_mem(&iov, sizeof(*hdr)); rsp = ascs_ase_cp_rsp_new(hdr->op); + if (!hdr->num) { + DBG(bap, "invalid Number_of_ASEs 0"); + ascs_ase_cp_rsp_add_truncated(rsp); + ret = 0; + goto respond; + } + for (handler = handlers; handler && handler->str; handler++) { if (handler->op != hdr->op) continue; @@ -3716,7 +3795,14 @@ static void ascs_ase_cp_write(struct gatt_db_attribute *attrib, DBG(bap, "invalid len %u < %u " "hdr->num * handler->size", len, hdr->num * handler->size); - ret = BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN; + + if (ascs_ase_cp_rsp_invalid_len(hdr->op, iov.iov_len, + hdr->num)) { + ascs_ase_cp_rsp_add_truncated(rsp); + ret = 0; + } else + ret = BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN; + goto respond; } ^ permalink raw reply related [flat|nested] 14+ messages in thread
* RE: shared/bap: add ASE Control Point error responses 2026-06-09 10:25 ` [BlueZ PATCH v3 1/2] " raghu447 @ 2026-06-09 12:48 ` bluez.test.bot 0 siblings, 0 replies; 14+ messages in thread From: bluez.test.bot @ 2026-06-09 12:48 UTC (permalink / raw) To: linux-bluetooth, raghavendra.rao [-- Attachment #1: Type: text/plain, Size: 1600 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=1108483 ---Test result--- Test Summary: CheckPatch PASS 0.98 seconds GitLint PASS 0.65 seconds BuildEll PASS 20.32 seconds BluezMake PASS 611.99 seconds MakeCheck PASS 18.42 seconds MakeDistcheck PASS 236.40 seconds CheckValgrind PASS 275.40 seconds CheckSmatch WARNING 324.66 seconds bluezmakeextell PASS 165.73 seconds IncrementalBuild PASS 913.48 seconds ScanBuild PASS 925.24 seconds Details ############################## Test: CheckSmatch - WARNING Desc: Run smatch tool with source Output: src/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures https://github.com/bluez/bluez/pull/2199 --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 14+ messages in thread
* [BlueZ PATCH v3 2/2] unit/bap: add SPE tests 2026-06-09 10:25 ` [BlueZ PATCH v3 0/2] " raghu447 2026-06-09 10:25 ` [BlueZ PATCH v3 1/2] " raghu447 @ 2026-06-09 10:25 ` raghu447 2026-06-09 15:20 ` [BlueZ PATCH v3 0/2] shared/bap: add ASE Control Point error responses patchwork-bot+bluetooth 2 siblings, 0 replies; 14+ messages in thread From: raghu447 @ 2026-06-09 10:25 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghu447 Add unit tests for the PTS BAP/USR/SPE/BI-01[5]-C tests. --- unit/test-bap.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/unit/test-bap.c b/unit/test-bap.c index 3a67e7016..e43d1d2ef 100644 --- a/unit/test-bap.c +++ b/unit/test-bap.c @@ -4349,6 +4349,69 @@ static void test_scc_metadata(void) test_usr_scc_metadata(); } +#define ASE_CP_RSP(_op, _ase, _code, _reason) \ + IOV_DATA(0x1b, CP_HND, _op, 0x01, _ase, _code, _reason) + +#define ASE_CP_RSP_TRUNCATED(_op) \ + IOV_DATA(0x1b, CP_HND, _op, 0xff, 0x00, 0x02, 0x00) + +#define SPE_CP_TRUNCATED(_op) \ + IOV_DATA(0x52, CP_HND, _op), \ + ASE_CP_RSP_TRUNCATED(_op) + +#define SPE_CP_ZERO_ASES(_op) \ + IOV_DATA(0x52, CP_HND, _op, 0x00), \ + ASE_CP_RSP_TRUNCATED(_op) + +#define SPE_METADATA_TRUNCATED(_ase) \ + IOV_DATA(0x52, CP_HND, 0x07, 0x01, _ase), \ + ASE_CP_RSP_TRUNCATED(0x07) + +#define SPE_METADATA_UNSUPPORTED(_ase) \ + SCC_SRC_ENABLE, \ + IOV_DATA(0x52, CP_HND, 0x07, 0x01, _ase, 0x02, 0x01, 0xfc), \ + ASE_CP_RSP(0x07, _ase, 0x0a, 0xfc) + +#define SPE_METADATA_INVALID_CONTEXT(_ase) \ + SCC_SRC_ENABLE, \ + IOV_DATA(0x52, CP_HND, 0x07, 0x01, _ase, 0x04, 0x03, 0x02, \ + 0x00, 0x10), \ + ASE_CP_RSP(0x07, _ase, 0x0c, 0x02) + +/* Unicast Server Rejects Invalid ASE Control Point Procedures + * + * Test Purpose: + * Verify the behavior of a Unicast Server IUT when a Unicast Client writes + * invalid ASE Control Point parameters. + * + * Pass verdict: + * The IUT sends a notification of the ASE Control Point characteristic with + * the expected Response_Code and Reason values. + */ +static void test_usr_spe(void) +{ + define_test("BAP/USR/SPE/BI-01-C [USR ASE Control Point truncated]", + test_setup_server, test_server, NULL, + SPE_CP_TRUNCATED(0x03)); + define_test("BAP/USR/SPE/BI-02-C [USR ASE Control Point zero ASEs]", + test_setup_server, test_server, NULL, + SPE_CP_ZERO_ASES(0x03)); + define_test("BAP/USR/SPE/BI-03-C [USR Update Metadata truncated]", + test_setup_server, test_server, NULL, + SPE_METADATA_TRUNCATED(SRC_ID(0))); + define_test("BAP/USR/SPE/BI-04-C [USR Update Metadata unsupported]", + test_setup_server, test_server, &cfg_src_enable, + SPE_METADATA_UNSUPPORTED(SRC_ID(0))); + define_test("BAP/USR/SPE/BI-05-C [USR Update Metadata invalid context]", + test_setup_server, test_server, &cfg_src_enable, + SPE_METADATA_INVALID_CONTEXT(SRC_ID(0))); +} + +static void test_spe(void) +{ + test_usr_spe(); +} + #define SNK_ENABLE \ IOV_DATA(0x52, 0x22, 0x00, 0x03, 0x01, 0x01, 0x04, 0x03, 0x02, 0x01, \ 00), \ @@ -10259,6 +10322,7 @@ int main(int argc, char *argv[]) tester_init(&argc, &argv); test_disc(); + test_spe(); test_scc(); test_bsrc_scc(); test_bsnk_scc(); ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [BlueZ PATCH v3 0/2] shared/bap: add ASE Control Point error responses 2026-06-09 10:25 ` [BlueZ PATCH v3 0/2] " raghu447 2026-06-09 10:25 ` [BlueZ PATCH v3 1/2] " raghu447 2026-06-09 10:25 ` [BlueZ PATCH v3 2/2] unit/bap: add SPE tests raghu447 @ 2026-06-09 15:20 ` patchwork-bot+bluetooth 2 siblings, 0 replies; 14+ messages in thread From: patchwork-bot+bluetooth @ 2026-06-09 15:20 UTC (permalink / raw) To: raghu447; +Cc: linux-bluetooth Hello: This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>: On Tue, 9 Jun 2026 15:55:46 +0530 you wrote: > Added bap unit tests in a seperate patch. > These changes are required to Pass BAP/USR/SPE/BI-01[5]-C tests. > > raghu447 (2): > shared/bap: add ASE Control Point error responses > unit/bap: add SPE tests > > [...] Here is the summary with links: - [BlueZ,v3,1/2] shared/bap: add ASE Control Point error responses https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=8bc6dd81c9c2 - [BlueZ,v3,2/2] unit/bap: add SPE tests https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=912d67d1d3a4 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [BlueZ PATCH 0/1] shared/bap: add ASE Control Point error responses 2026-06-02 8:29 [BlueZ PATCH 0/1] shared/bap: add ASE Control Point error responses raghu447 2026-06-02 8:29 ` [BlueZ PATCH 1/1] " raghu447 @ 2026-06-02 14:53 ` Luiz Augusto von Dentz 1 sibling, 0 replies; 14+ messages in thread From: Luiz Augusto von Dentz @ 2026-06-02 14:53 UTC (permalink / raw) To: raghu447; +Cc: linux-bluetooth Hi Raghu, On Tue, Jun 2, 2026 at 4:35 AM raghu447 <raghavendra.rao@collabora.com> wrote: > > This patch adds the responses that are expected by PTS. > These changes are requited to Pass PTS tests BAP/USR/SPE/BI-01[5]-C. Hmm, it doesn't look like we have any SPE test case captured in unit/test-bap.c, maybe we should start with that. > raghavendra (1): > shared/bap: add ASE Control Point error responses > > src/shared/bap.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 76 insertions(+), 2 deletions(-) > > -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2026-06-09 15:20 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-06-02 8:29 [BlueZ PATCH 0/1] shared/bap: add ASE Control Point error responses raghu447 2026-06-02 8:29 ` [BlueZ PATCH 1/1] " raghu447 2026-06-02 11:51 ` bluez.test.bot 2026-06-02 15:01 ` [BlueZ PATCH 1/1] " Luiz Augusto von Dentz 2026-06-04 5:20 ` [BlueZ PATCH v2 0/1] " raghu447 2026-06-04 5:20 ` [BlueZ PATCH v2 1/1] " raghu447 2026-06-04 9:02 ` bluez.test.bot 2026-06-04 14:56 ` [BlueZ PATCH v2 1/1] " Luiz Augusto von Dentz 2026-06-09 10:25 ` [BlueZ PATCH v3 0/2] " raghu447 2026-06-09 10:25 ` [BlueZ PATCH v3 1/2] " raghu447 2026-06-09 12:48 ` bluez.test.bot 2026-06-09 10:25 ` [BlueZ PATCH v3 2/2] unit/bap: add SPE tests raghu447 2026-06-09 15:20 ` [BlueZ PATCH v3 0/2] shared/bap: add ASE Control Point error responses patchwork-bot+bluetooth 2026-06-02 14:53 ` [BlueZ PATCH 0/1] " Luiz Augusto von Dentz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox