All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Frédéric Danis" <frederic.danis@collabora.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v2 2/2] sco-tester: Add test for BT_VOICE_TRANSPARENT_16BIT constant
Date: Mon, 16 Dec 2024 19:46:13 +0100	[thread overview]
Message-ID: <20241216184613.135538-3-frederic.danis@collabora.com> (raw)
In-Reply-To: <20241216184613.135538-1-frederic.danis@collabora.com>

This test checks that BT_VOICE_TRANSPARENT_16BIT voice settings can
be set and get using [set|get]sockopt().
---
 tools/sco-tester.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/tools/sco-tester.c b/tools/sco-tester.c
index a56cb9153..6fc26b7af 100644
--- a/tools/sco-tester.c
+++ b/tools/sco-tester.c
@@ -527,6 +527,34 @@ static void test_setsockopt(const void *test_data)
 		goto end;
 	}
 
+	memset(&voice, 0, sizeof(voice));
+	voice.setting = BT_VOICE_TRANSPARENT_16BIT;
+
+	err = setsockopt(sk, SOL_BLUETOOTH, BT_VOICE, &voice, sizeof(voice));
+	if (err < 0) {
+		tester_warn("Can't set socket option : %s (%d)",
+							strerror(errno), errno);
+		tester_test_failed();
+		goto end;
+	}
+
+	len = sizeof(voice);
+	memset(&voice, 0, len);
+
+	err = getsockopt(sk, SOL_BLUETOOTH, BT_VOICE, &voice, &len);
+	if (err < 0) {
+		tester_warn("Can't get socket option : %s (%d)",
+							strerror(errno), errno);
+		tester_test_failed();
+		goto end;
+	}
+
+	if (voice.setting != BT_VOICE_TRANSPARENT_16BIT) {
+		tester_warn("Invalid voice setting");
+		tester_test_failed();
+		goto end;
+	}
+
 	memset(&voice, 0, sizeof(voice));
 	voice.setting = BT_VOICE_TRANSPARENT;
 
-- 
2.34.1


  parent reply	other threads:[~2024-12-16 18:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-16 18:46 [PATCH BlueZ v2 0/2] Add constant for 16 bits transparent voice Frédéric Danis
2024-12-16 18:46 ` [PATCH BlueZ v2 1/2] lib: Add constant for 16 bits transparent voice setting Frédéric Danis
2024-12-16 20:07   ` Add constant for 16 bits transparent voice bluez.test.bot
2024-12-16 18:46 ` Frédéric Danis [this message]
2024-12-16 21:50 ` [PATCH BlueZ v2 0/2] " patchwork-bot+bluetooth

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=20241216184613.135538-3-frederic.danis@collabora.com \
    --to=frederic.danis@collabora.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.