From: Simon Mikuda <simon.mikuda@streamunlimited.com>
To: linux-bluetooth@vger.kernel.org
Cc: Simon Mikuda <simon.mikuda@streamunlimited.com>
Subject: [PATCH BlueZ 3/3] unit/test-vcp: Add tests for Volume State changes
Date: Tue, 24 Nov 2026 15:36:01 +0100 [thread overview]
Message-ID: <20261124143601.245340-3-simon.mikuda@streamunlimited.com> (raw)
In-Reply-To: <20261124143601.245340-1-simon.mikuda@streamunlimited.com>
Check that a Mute notifies Volume State, and that operations which
change neither Volume_Setting nor Mute leave Change_Counter as it is.
Assisted-by: Claude:claude-opus-5-5
---
unit/test-vcp.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
diff --git a/unit/test-vcp.c b/unit/test-vcp.c
index 4ec4da428..ef27fda32 100644
--- a/unit/test-vcp.c
+++ b/unit/test-vcp.c
@@ -2761,12 +2761,85 @@ static void test_aics_unit_testcases(void)
}
+/* ATT: Write Request (0x12) len 4
+ * Handle: 0x0024 Type: Volume Control Point (0x2b7e)
+ * Data: 0600
+ * Opcode: Mute (0x06)
+ * Change Counter: 0
+ * ATT: Write Response (0x13) len 0
+ * ATT: Handle Value Notification (0x1b) len 5
+ * Handle: 0x0021 Type: Volume State (0x2b7d)
+ * Data: 000101
+ * Volume Setting: 0
+ * Mute: 1
+ * Change Counter: 1
+ */
+#define VCS_CP_MUTE \
+ IOV_DATA(0x12, 0x24, 0x00, 0x06, 0x00), \
+ IOV_DATA(0x13), \
+ IOV_NULL, \
+ IOV_DATA(0x1b, 0x21, 0x00, 0x00, 0x01, 0x01)
+
+/* ATT: Write Request (0x12) len 5
+ * Handle: 0x0024 Type: Volume Control Point (0x2b7e)
+ * Data: 040000
+ * Opcode: Set Absolute Volume (0x04)
+ * Change Counter: 0
+ * Volume Setting: 0
+ * ATT: Write Response (0x13) len 0
+ * ATT: Write Request (0x12) len 4
+ * Handle: 0x0024 Type: Volume Control Point (0x2b7e)
+ * Data: 0500
+ * Opcode: Unmute (0x05)
+ * Change Counter: 0
+ * ATT: Write Response (0x13) len 0
+ * ATT: Write Request (0x12) len 4
+ * Handle: 0x0024 Type: Volume Control Point (0x2b7e)
+ * Data: 0000
+ * Opcode: Relative Volume Down (0x00)
+ * Change Counter: 0
+ * ATT: Write Response (0x13) len 0
+ * ATT: Write Request (0x12) len 5
+ * Handle: 0x0024 Type: Volume Control Point (0x2b7e)
+ * Data: 040010
+ * Opcode: Set Absolute Volume (0x04)
+ * Change Counter: 0
+ * Volume Setting: 16
+ * ATT: Write Response (0x13) len 0
+ * ATT: Handle Value Notification (0x1b) len 5
+ * Handle: 0x0021 Type: Volume State (0x2b7d)
+ * Data: 100001
+ * Volume Setting: 16
+ * Mute: 0
+ * Change Counter: 1
+ */
+#define VCS_CP_NO_CHANGE \
+ IOV_DATA(0x12, 0x24, 0x00, 0x04, 0x00, 0x00), \
+ IOV_DATA(0x13), \
+ IOV_DATA(0x12, 0x24, 0x00, 0x05, 0x00), \
+ IOV_DATA(0x13), \
+ IOV_DATA(0x12, 0x24, 0x00, 0x00, 0x00), \
+ IOV_DATA(0x13), \
+ IOV_DATA(0x12, 0x24, 0x00, 0x04, 0x00, 0x10), \
+ IOV_DATA(0x13), \
+ IOV_NULL, \
+ IOV_DATA(0x1b, 0x21, 0x00, 0x10, 0x00, 0x01)
+
+static void test_vcs_unit_testcases(void)
+{
+ define_test("VCS/SR/CP/BLUEZ-1 [Mute notifies Volume State]",
+ test_server, NULL, VCS_CP_MUTE);
+ define_test("VCS/SR/CP/BLUEZ-2 [No change keeps Change Counter]",
+ test_server, NULL, VCS_CP_NO_CHANGE);
+}
+
int main(int argc, char *argv[])
{
tester_init(&argc, &argv);
test_vocs_unit_testcases();
test_aics_unit_testcases();
+ test_vcs_unit_testcases();
return tester_run();
}
--
2.43.0
next prev parent reply other threads:[~2026-11-24 14:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 14:35 [PATCH BlueZ 1/3] shared/vcp: Notify Volume State on Mute Simon Mikuda
2026-11-24 14:36 ` [PATCH BlueZ 2/3] shared/vcp: Keep Change_Counter on operations that change nothing Simon Mikuda
2026-11-24 14:36 ` Simon Mikuda [this message]
2026-11-24 20:43 ` [BlueZ,1/3] shared/vcp: Notify Volume State on Mute bluez.test.bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261124143601.245340-3-simon.mikuda@streamunlimited.com \
--to=simon.mikuda@streamunlimited.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox