Skip to contentSkip to conversation

Add constant for 16 bits transparent voice

PATCH Applied Frédéric Danis 3 participants 5 messages Dec 16, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Add constant for 16 bits transparent voice

Add 16 bits, 2s complement, transparent air coding format for mSBC. Corresponding commit implements functionality on kernel side.

The voice setting is used by sco_connect() or sco_conn_defer_accept() after being set by sco_sock_setsockopt().

The PCM part of the voice setting is used for offload mode through PCM chipset port.
This commits add support for mSBC 16 bits offloading, i.e. audio data not transported over HCI.

The BCM4349B1 supports 16 bits transparent data on its I2S port. If BT_VOICE_TRANSPARENT is used when accepting a SCO connection, this gives only garbage audio while using BT_VOICE_TRANSPARENT_16BIT gives correct audio.
This has been tested with connection to iPhone 14 and Samsung S24.

This also adds a test to checks that BT_VOICE_TRANSPARENT_16BIT voice settings can be set and get using [set|get]sockopt().

v1 -> v2: Add test to tools/sco-tester

Frédéric Danis (2):
lib: Add constant for 16 bits transparent voice setting
sco-tester: Add test for BT_VOICE_TRANSPARENT_16BIT constant

 lib/bluetooth.h    |  1 +
 tools/sco-tester.c | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/2 lib: Add constant for 16 bits transparent voice setting

Add 16 bits, 2s complement, transparent air coding format for mSBC. Corresponding commit implements functionality on kernel side.

The voice setting is used by sco_connect() or sco_conn_defer_accept() after being set by sco_sock_setsockopt().

The PCM part of the voice setting is used for offload mode through PCM chipset port.
This commits add support for mSBC 16 bits offloading, i.e. audio data not transported over HCI.

The BCM4349B1 supports 16 bits transparent data on its I2S port. If BT_VOICE_TRANSPARENT is used when accepting a SCO connection, this gives only garbage audio while using BT_VOICE_TRANSPARENT_16BIT gives correct audio.
This has been tested with connection to iPhone 14 and Samsung S24.

---
 lib/bluetooth.h | 1 +
 1 file changed, 1 insertion(+)
lib/bluetooth.h +1 -0
index 073ed875d..32e58678b 100644
@@ -111,6 +111,7 @@ struct bt_voice {
 
 #define BT_VOICE_TRANSPARENT			0x0003
 #define BT_VOICE_CVSD_16BIT			0x0060
+#define BT_VOICE_TRANSPARENT_16BIT		0x0063
 
 #define BT_PHY			14
 
Signature · 1 line
2.34.1
#2 lore raw

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=918329

---Test result---

Test Summary:

CheckPatch                    PENDING   0.52 seconds
GitLint                       PENDING   0.39 seconds
BuildEll                      PASS      20.42 seconds
BluezMake                     PASS      1509.10 seconds
MakeCheck                     PASS      13.29 seconds
MakeDistcheck                 PASS      158.50 seconds
CheckValgrind                 PASS      215.34 seconds
CheckSmatch                   WARNING   272.81 seconds
bluezmakeextell               PASS      98.70 seconds
IncrementalBuild              PENDING   0.35 seconds
ScanBuild                     PASS      841.58 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
tools/sco-tester.c: note: in included file:./lib/bluetooth.h:220:15: warning: array of flexible structures./lib/bluetooth.h:225:31: warning: array of flexible structures
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:

---
Regards,
Linux Bluetooth

#3 lore raw

PATCH v2 2/2 sco-tester: Add test for BT_VOICE_TRANSPARENT_16BIT constant

In reply to Frédéric Danis

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(+)
tools/sco-tester.c +28 -0
index a56cb9153..6fc26b7af 100644
@@ -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;
 
Signature · 1 line
2.34.1
#4 lore raw
In reply to Frédéric Danis
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 6 lines · On Mon, 16 Dec 2024 19:46:11 +0100 you wrote:

Add 16 bits, 2s complement, transparent air coding format for mSBC. Corresponding commit implements functionality on kernel side.

The voice setting is used by sco_connect() or sco_conn_defer_accept() after being set by sco_sock_setsockopt().

Quoted 6 lines

The PCM part of the voice setting is used for offload mode through PCM chipset port.
This commits add support for mSBC 16 bits offloading, i.e. audio data not transported over HCI.

[...]

Here is the summary with links:
- [BlueZ,v2,1/2] lib: Add constant for 16 bits transparent voice setting

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=9b631e09e943
  - [BlueZ,v2,2/2] sco-tester: Add test for BT_VOICE_TRANSPARENT_16BIT constant
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=ff07f10ee4da

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html