From patchwork Mon Dec 16 18:46:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Fr=C3=A9d=C3=A9ric_Danis?= X-Patchwork-Id: 851846 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77D5A1E493 for ; Mon, 16 Dec 2024 18:46:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734374783; cv=none; b=Jn1MVZcH0RQU9ayp3r3qXV7iqwzfIPfr5t02/YESIWisqAp/PVL6Bdc5oI/r+HgbxSh7cZOr5vfCzgItkj6ufhiVy0fMNEG3mDtj7wdqeN7VwGjTqkGnxG0zXfjB4pGv7N8oiu3nJ6/PTLYu0oJZuKWVC+3L1g6dN8r+mOYblT0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734374783; c=relaxed/simple; bh=75k8vQfAdxNCyc8upk6BS2mFTnwef5NOPkGdceviGNk=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=BG6OMj0Q6PtJ+EyxnnjhVAlUFezqKkjPrXJE2yv/1zxSiMMmYXtm3AacOmXYjHFLPOZuDMcp9pLi3uK6TD9CApXMbIXsT36AJfa4bWWauEeKv7VV7crn0kKI/g/wcAT95es601Eb1hVQCO0INyp1ryHboNO+B2ZhHQGv+fO/Qp0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=ffpeZC83; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="ffpeZC83" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1734374779; bh=75k8vQfAdxNCyc8upk6BS2mFTnwef5NOPkGdceviGNk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ffpeZC83Wj5N1oBaIC1U49AamOup5/8BbC9W2JYBey8jZnKXhU/uIPVFeDzUkJ1Lh IN1jiIEBm5St1Zru9x5zzb/Wt2o5a3YSBY8APRLulgYAEdLyOdg6oDFk9AcJOvYYTN l2gLzLIIeAVhrOcuTq/1F3vVdQRyYQFdSvEsIk+bAPr8ucha2z0cn6lXtut6fRgiTo YjaoJE85pL2nyXVx/VFA8K9nYjH6RnS1o411osSDWj3HSg57d5kIQMI18TbQY8Iz5n bhIxDfF+4uTwfK2Oq4DgFiUF9pc9WOuVRNOYr3qZrjiEL7Ii2THDdYogKWFj2WqXY5 cNRjJbnk4l99g== Received: from fdanis-XPS-13-9370.. (67.227.121.78.rev.sfr.net [78.121.227.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: fdanis) by bali.collaboradmins.com (Postfix) with ESMTPSA id E18CD17E37E7 for ; Mon, 16 Dec 2024 19:46:18 +0100 (CET) From: =?utf-8?q?Fr=C3=A9d=C3=A9ric_Danis?= To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v2 1/2] lib: Add constant for 16 bits transparent voice setting Date: Mon, 16 Dec 2024 19:46:12 +0100 Message-Id: <20241216184613.135538-2-frederic.danis@collabora.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241216184613.135538-1-frederic.danis@collabora.com> References: <20241216184613.135538-1-frederic.danis@collabora.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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(+) diff --git a/lib/bluetooth.h b/lib/bluetooth.h index 073ed875d..32e58678b 100644 --- a/lib/bluetooth.h +++ b/lib/bluetooth.h @@ -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 From patchwork Mon Dec 16 18:46:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Fr=C3=A9d=C3=A9ric_Danis?= X-Patchwork-Id: 851845 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77DDB6F2F2 for ; Mon, 16 Dec 2024 18:46:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734374784; cv=none; b=oKGrWqrJ7JWHu64jhcWJcXCig/3dH9Cdo/plwiqacbr63UdRj5KG7Y8j46jt7FYj9Kb/Ky5ZNpWC07BGRBT2eXxGQkT7FnO4mNUSINNraw70KQu56NE2bgZ1jdNt44rhjxLPrgaVzXi4t+8UJwSinFiMfRwXpc6wGET0vWpVi0I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734374784; c=relaxed/simple; bh=R61vrVbfWfAizz08oLCxrVE34q9pAkUmZ0k/IO7xPiQ=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=bE9rJi8nqHitXURa+CHlj6/GSAOPaEay1XHetPUgmx0M2h8/9Z3tA7UbG/eejKj3S5NHxb6cmcRSUfS4e1WUNMrNi9szo3uKEd+7lHq9FoNrA2vS8bAnKm++2hwvWH79vvncqHkWPcQyNnO37G4ahmqGLKPMhoMjncuW2DzXdQE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=J9i+Lwmk; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="J9i+Lwmk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1734374779; bh=R61vrVbfWfAizz08oLCxrVE34q9pAkUmZ0k/IO7xPiQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=J9i+Lwmk2i1lgHXPf0b7Kyo6GWJNZgGNEemHoyGui0Txufjb4ULubhPPhEI/x5RDt HyCxAmV8hm3lpzpq57M+f2uyOiakftAnnzoAy7RDyeLhA+nH0CVx/PXqTp0GSmkMji yhYzXo/KkHRgZqf0pajjP+raHVgpJUSEhKEuARK/SfV5O4F3cjABrL3FcUmWRYL4Dh mdEvbMa2tNsLJFufVuRkJpOpWXNuTb/AubDgGKTWUxIOuaHohdVMzqxUFqQI9Urvbl 1qLS4s2LKaLFErKh3kcIC1y2lvAYhnQSwYD35fnGTNz+QyHiaIEcGT8TfnUm7QfYBk 5iSXl9+nHlW8g== Received: from fdanis-XPS-13-9370.. (67.227.121.78.rev.sfr.net [78.121.227.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: fdanis) by bali.collaboradmins.com (Postfix) with ESMTPSA id 2B9F717E37EA for ; Mon, 16 Dec 2024 19:46:19 +0100 (CET) From: =?utf-8?q?Fr=C3=A9d=C3=A9ric_Danis?= 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 Message-Id: <20241216184613.135538-3-frederic.danis@collabora.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241216184613.135538-1-frederic.danis@collabora.com> References: <20241216184613.135538-1-frederic.danis@collabora.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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;