Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/2] shared/bap: Don't fail an ASE CP write with an unknown opcode
@ 2026-11-24 13:31 Simon Mikuda
  2026-11-24 13:31 ` [PATCH BlueZ 2/2] unit/test-bap: Add test for an unknown ASE CP opcode Simon Mikuda
  2026-11-24 20:38 ` [BlueZ,1/2] shared/bap: Don't fail an ASE CP write with an unknown opcode bluez.test.bot
  0 siblings, 2 replies; 3+ messages in thread
From: Simon Mikuda @ 2026-11-24 13:31 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda

A write of an unknown opcode to the ASE Control Point is answered with
an Unsupported Opcode notification, but the write itself still fails
with Request Not Supported, as ret keeps its initial value. The other
Control Point errors, such as a truncated or zero ASEs write, are only
reported in the notification and the write succeeds, so do the same
for an unknown opcode.

Fixes: b798cec4ca62 ("shared/bap: Add initial code for handling BAP")
Assisted-by: Claude:claude-opus-5-5
---
 src/shared/bap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 8fc28de52..e17e9cb60 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -4171,6 +4171,7 @@ static void ascs_ase_cp_write(struct gatt_db_attribute *attrib,
 	} else {
 		DBG(bap, "Unknown opcode 0x%02x", hdr->op);
 		ascs_ase_rsp_add_errno(rsp, 0x00, -ENOTSUP);
+		ret = 0;
 	}
 
 respond:

base-commit: 1608f836188610aabeff5a3164169ebe0360e443
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH BlueZ 2/2] unit/test-bap: Add test for an unknown ASE CP opcode
  2026-11-24 13:31 [PATCH BlueZ 1/2] shared/bap: Don't fail an ASE CP write with an unknown opcode Simon Mikuda
@ 2026-11-24 13:31 ` Simon Mikuda
  2026-11-24 20:38 ` [BlueZ,1/2] shared/bap: Don't fail an ASE CP write with an unknown opcode bluez.test.bot
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Mikuda @ 2026-11-24 13:31 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda

Write an unknown opcode to the ASE Control Point with a Write Request
and expect the Unsupported Opcode notification and a Write Response.

Assisted-by: Claude:claude-opus-5-5
---
 unit/test-bap.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/unit/test-bap.c b/unit/test-bap.c
index bfe98a885..7c5f94d86 100644
--- a/unit/test-bap.c
+++ b/unit/test-bap.c
@@ -4624,6 +4624,26 @@ static void test_scc_metadata(void)
 	IOV_DATA(0x52, CP_HND, _op, 0x00), \
 	ASE_CP_RSP_TRUNCATED(_op)
 
+/* ATT: Write Request (0x12) len 5
+ *   Handle: 0x0022 Type: ASE Control Point (0x2bc6)
+ *     Data: 0f0101
+ * ATT: Write Response (0x13) len 0
+ * ATT: Handle Value Notification (0x1b) len 7
+ *   Handle: 0x0022 Type: ASE Control Point (0x2bc6)
+ *     Data: 0fff000100
+ *       Opcode: Unknown (0x0f)
+ *       Number of ASE(s): 255
+ *       ASE: #0
+ *       ASE ID: 0x00
+ *       ASE Response Code: Unsupported Opcode (0x01)
+ *       ASE Response Reason: None (0x00)
+ */
+#define SPE_CP_UNSUPPORTED(_op) \
+	IOV_DATA(0x12, CP_HND, _op, 0x01, 0x01), \
+	IOV_DATA(0x13), \
+	IOV_NULL, \
+	IOV_DATA(0x1b, CP_HND, _op, 0xff, 0x00, 0x01, 0x00)
+
 #define SPE_METADATA_TRUNCATED(_ase) \
 	IOV_DATA(0x52, CP_HND, 0x07, 0x01, _ase), \
 	ASE_CP_RSP_TRUNCATED(0x07)
@@ -4657,6 +4677,10 @@ static void test_usr_spe(void)
 	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/BLUEZ-1 [USR ASE Control Point unsupported "
+			"opcode]",
+			test_setup_server, test_server, NULL,
+			SPE_CP_UNSUPPORTED(0x0f));
 	define_test("BAP/USR/SPE/BI-03-C [USR Update Metadata truncated]",
 			test_setup_server, test_server, NULL,
 			SPE_METADATA_TRUNCATED(SRC_ID(0)));
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [BlueZ,1/2] shared/bap: Don't fail an ASE CP write with an unknown opcode
  2026-11-24 13:31 [PATCH BlueZ 1/2] shared/bap: Don't fail an ASE CP write with an unknown opcode Simon Mikuda
  2026-11-24 13:31 ` [PATCH BlueZ 2/2] unit/test-bap: Add test for an unknown ASE CP opcode Simon Mikuda
@ 2026-11-24 20:38 ` bluez.test.bot
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-11-24 20:38 UTC (permalink / raw)
  To: linux-bluetooth, simon.mikuda

[-- Attachment #1: Type: text/plain, Size: 1631 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/series/1220883/

---Test result---

Test Summary:
CheckPatch                    PASS      0.68 seconds
GitLint                       PASS      0.52 seconds
BuildEll                      PASS      14.84 seconds
BluezMake                     PASS      195.72 seconds
MakeCheck                     PASS      12.99 seconds
MakeDistcheck                 PASS      102.22 seconds
CheckValgrind                 PASS      230.92 seconds
CheckSmatch                   WARNING   179.28 seconds
bluezmakeextell               PASS      61.28 seconds
TestFunctional                PASS      911.65 seconds
IncrementalBuild              PASS      208.51 seconds
ScanBuild                     PASS      601.64 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/2902

---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-24 20:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 13:31 [PATCH BlueZ 1/2] shared/bap: Don't fail an ASE CP write with an unknown opcode Simon Mikuda
2026-11-24 13:31 ` [PATCH BlueZ 2/2] unit/test-bap: Add test for an unknown ASE CP opcode Simon Mikuda
2026-11-24 20:38 ` [BlueZ,1/2] shared/bap: Don't fail an ASE CP write with an unknown opcode bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox