public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/11] Initial BAP support
@ 2022-08-27  0:05 Luiz Augusto von Dentz
  2022-08-27  0:05 ` [PATCH v3 01/11] adapter: Add btd_adapter_find_device_by_fd Luiz Augusto von Dentz
                   ` (11 more replies)
  0 siblings, 12 replies; 16+ messages in thread
From: Luiz Augusto von Dentz @ 2022-08-27  0:05 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

iThis set add initial support for BAP (Basic Audio Profile) which is
an essential part of LE Audio responsible for stream control.

The plugin is considered experimental and depends on ISO socket in order
to work so the following setting needs to be changed in order to enable it:

 # Enables D-Bus experimental interfaces
 # Possible values: true or false
+Experimental = true

 # Enables kernel experimental features, alternatively a list of UUIDs
 # can be given.
@@ -126,7 +126,7 @@
 # a6695ace-ee7f-4fb9-881a-5fac66c629af (BlueZ Experimental Offload Codecs)
 # 6fbaf188-05e0-496a-9885-d6ddfdb4e03e (BlueZ Experimental ISO socket)
 # Defaults to false.
+KernelExperimental = 6fbaf188-05e0-496a-9885-d6ddfdb4e03e

While proper support to the likes of PulseAudio and Pipewire are still
in progress it is possible to test using bluetoothctl with the following
commands:

[Server/Peripheral]
[bluetooth]# power on
[bluetooth]# advertise on
[bluetooth]# endpoint.register 00002bc9-0000-1000-8000-00805f9b34fb 0x06
[/local/endpoint/ep0] Auto Accept (yes/no): y
[/local/endpoint/ep0] CIG (auto/value): a
[/local/endpoint/ep0] CIS (auto/value): a
Capabilities:
  03 01 ff 00 02 02 03 02 03 03 05 04 1e 00 f0 00  ................
Endpoint /local/endpoint/ep0 registered
[bluetooth]# endpoint.register 00002bcb-0000-1000-8000-00805f9b34fb 0x06
[/local/endpoint/ep1] Auto Accept (yes/no): y
[/local/endpoint/ep1] CIG (auto/value): a
[/local/endpoint/ep1] CIS (auto/value): a
Capabilities:
  03 01 ff 00 02 02 03 02 03 03 05 04 1e 00 f0 00  ................
Endpoint /local/endpoint/ep1 registered

[Client/Central]
[bluetooth]# power on
[bluetooth]# endpoint.register 00002bc9-0000-1000-8000-00805f9b34fb 0x06
[/local/endpoint/ep0] Auto Accept (yes/no): y
[/local/endpoint/ep0] CIG (auto/value): a
[/local/endpoint/ep0] CIS (auto/value): a
Capabilities:
  03 01 ff 00 02 02 03 02 03 03 05 04 1e 00 f0 00  ................
Endpoint /local/endpoint/ep0 registered
[bluetooth]# endpoint.register 00002bcb-0000-1000-8000-00805f9b34fb 0x06
[/local/endpoint/ep1] Auto Accept (yes/no): y
[/local/endpoint/ep1] CIG (auto/value): a
[/local/endpoint/ep1] CIS (auto/value): a
Capabilities:
  03 01 ff 00 02 02 03 02 03 03 05 04 1e 00 f0 00  ................
Endpoint /local/endpoint/ep1 registered
[bluetooth]# scan on
[bluetooth]# scan off
[bluetooth]# connect <bdaddr>
[NEW] Transport /org/bluez/hci0/dev_00_AA_01_01_00_02/pac_source0/fd0
Endpoint: SetConfiguration
        Transport /org/bluez/hci0/dev_00_AA_01_01_00_02/pac_source0/fd0
        Device: /org/bluez/hci0/dev_00_AA_01_01_00_02
Auto Accepting...
[NEW] Transport /org/bluez/hci0/dev_00_AA_01_01_00_02/pac_sink0/fd1
Endpoint: SetConfiguration
        Transport /org/bluez/hci0/dev_00_AA_01_01_00_02/pac_sink0/fd1
        Device: /org/bluez/hci0/dev_00_AA_01_01_00_02
Auto Accepting...
[bluetooth]# transport.acquire /org/bluez/hci0/dev_00_AA_01_01_00_02/pac_sink0/fd1

Frédéric Danis (2):
  profiles: Allow linked transport to release the fd
  profiles: Update transport Links property on state change to QoS

Luiz Augusto von Dentz (9):
  adapter: Add btd_adapter_find_device_by_fd
  lib/uuid: Add PACS/ASCS UUIDs
  shared/bap: Add initial code for handling BAP
  profiles: Add initial code for bap plugin
  shared: Add definition for LC3 codec
  media-api: Add SelectProperties
  test/simple-endpoint: Add support for LC3 endpoints
  client/player: Add support for PACS endpoints
  client/player: Use QoS interval on transport.send

 Makefile.am                |    3 +-
 Makefile.plugins           |    5 +
 client/player.c            |  688 +++++-
 configure.ac               |    4 +
 doc/media-api.txt          |   88 +-
 lib/uuid.h                 |   18 +
 profiles/audio/bap.c       | 1324 ++++++++++
 profiles/audio/media.c     |  678 ++++-
 profiles/audio/transport.c |  596 ++++-
 profiles/audio/transport.h |    3 +-
 src/adapter.c              |   33 +
 src/adapter.h              |    1 +
 src/device.c               |   10 +-
 src/shared/ascs.h          |  196 ++
 src/shared/bap.c           | 4776 ++++++++++++++++++++++++++++++++++++
 src/shared/bap.h           |  269 ++
 src/shared/lc3.h           |  112 +
 test/simple-endpoint       |   17 +
 tools/bluetooth-player.c   |    1 -
 19 files changed, 8678 insertions(+), 144 deletions(-)
 create mode 100644 profiles/audio/bap.c
 create mode 100644 src/shared/ascs.h
 create mode 100644 src/shared/bap.c
 create mode 100644 src/shared/bap.h
 create mode 100644 src/shared/lc3.h

-- 
2.37.2


^ permalink raw reply	[flat|nested] 16+ messages in thread
* [PATCH v2 1/9] adapter: Add btd_adapter_find_device_by_fd
@ 2022-08-26 23:20 Luiz Augusto von Dentz
  2022-08-27  0:20 ` Initial BAP support bluez.test.bot
  0 siblings, 1 reply; 16+ messages in thread
From: Luiz Augusto von Dentz @ 2022-08-26 23:20 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds btd_adapter_find_device_by_fd that lookup a device by a fd
socket destination address.
---
 src/adapter.c | 33 +++++++++++++++++++++++++++++++++
 src/adapter.h |  1 +
 2 files changed, 34 insertions(+)

diff --git a/src/adapter.c b/src/adapter.c
index b453e86a03c1..51b099daefdf 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1383,6 +1383,39 @@ struct btd_device *btd_adapter_get_device(struct btd_adapter *adapter,
 	return adapter_create_device(adapter, addr, addr_type);
 }
 
+struct btd_device *btd_adapter_find_device_by_fd(int fd)
+{
+	bdaddr_t src, dst;
+	uint8_t dst_type;
+	GIOChannel *io = NULL;
+	GError *gerr = NULL;
+	struct btd_adapter *adapter;
+
+	io = g_io_channel_unix_new(fd);
+	if (!io)
+		return NULL;
+
+	bt_io_get(io, &gerr,
+			BT_IO_OPT_SOURCE_BDADDR, &src,
+			BT_IO_OPT_DEST_BDADDR, &dst,
+			BT_IO_OPT_DEST_TYPE, &dst_type,
+			BT_IO_OPT_INVALID);
+	if (gerr) {
+		error("bt_io_get: %s", gerr->message);
+		g_error_free(gerr);
+		g_io_channel_unref(io);
+		return NULL;
+	}
+
+	g_io_channel_unref(io);
+
+	adapter = adapter_find(&src);
+	if (!adapter)
+		return NULL;
+
+	return btd_adapter_find_device(adapter, &dst, dst_type);
+}
+
 sdp_list_t *btd_adapter_get_services(struct btd_adapter *adapter)
 {
 	return adapter->services;
diff --git a/src/adapter.h b/src/adapter.h
index b09044edda70..f38f473b79d7 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -86,6 +86,7 @@ struct btd_device *btd_adapter_find_device(struct btd_adapter *adapter,
 							uint8_t dst_type);
 struct btd_device *btd_adapter_find_device_by_path(struct btd_adapter *adapter,
 						   const char *path);
+struct btd_device *btd_adapter_find_device_by_fd(int fd);
 
 void btd_adapter_update_found_device(struct btd_adapter *adapter,
 					const bdaddr_t *bdaddr,
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread
* [PATCH BlueZ 1/9] adapter: Add btd_adapter_find_device_by_fd
@ 2022-08-17 23:41 Luiz Augusto von Dentz
  2022-08-18  3:50 ` Initial BAP support bluez.test.bot
  0 siblings, 1 reply; 16+ messages in thread
From: Luiz Augusto von Dentz @ 2022-08-17 23:41 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds btd_adapter_find_device_by_fd that lookup a device by a fd
socket destination address.
---
 src/adapter.c | 33 +++++++++++++++++++++++++++++++++
 src/adapter.h |  1 +
 2 files changed, 34 insertions(+)

diff --git a/src/adapter.c b/src/adapter.c
index ec26aab1a771..d33fc9bd661c 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1364,6 +1364,39 @@ struct btd_device *btd_adapter_get_device(struct btd_adapter *adapter,
 	return adapter_create_device(adapter, addr, addr_type);
 }
 
+struct btd_device *btd_adapter_find_device_by_fd(int fd)
+{
+	bdaddr_t src, dst;
+	uint8_t dst_type;
+	GIOChannel *io = NULL;
+	GError *gerr = NULL;
+	struct btd_adapter *adapter;
+
+	io = g_io_channel_unix_new(fd);
+	if (!io)
+		return NULL;
+
+	bt_io_get(io, &gerr,
+			BT_IO_OPT_SOURCE_BDADDR, &src,
+			BT_IO_OPT_DEST_BDADDR, &dst,
+			BT_IO_OPT_DEST_TYPE, &dst_type,
+			BT_IO_OPT_INVALID);
+	if (gerr) {
+		error("bt_io_get: %s", gerr->message);
+		g_error_free(gerr);
+		g_io_channel_unref(io);
+		return NULL;
+	}
+
+	g_io_channel_unref(io);
+
+	adapter = adapter_find(&src);
+	if (!adapter)
+		return NULL;
+
+	return btd_adapter_find_device(adapter, &dst, dst_type);
+}
+
 sdp_list_t *btd_adapter_get_services(struct btd_adapter *adapter)
 {
 	return adapter->services;
diff --git a/src/adapter.h b/src/adapter.h
index b09044edda70..f38f473b79d7 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -86,6 +86,7 @@ struct btd_device *btd_adapter_find_device(struct btd_adapter *adapter,
 							uint8_t dst_type);
 struct btd_device *btd_adapter_find_device_by_path(struct btd_adapter *adapter,
 						   const char *path);
+struct btd_device *btd_adapter_find_device_by_fd(int fd);
 
 void btd_adapter_update_found_device(struct btd_adapter *adapter,
 					const bdaddr_t *bdaddr,
-- 
2.37.2


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

end of thread, other threads:[~2022-08-29 19:50 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-27  0:05 [PATCH v3 00/11] Initial BAP support Luiz Augusto von Dentz
2022-08-27  0:05 ` [PATCH v3 01/11] adapter: Add btd_adapter_find_device_by_fd Luiz Augusto von Dentz
2022-08-27  3:53   ` Initial BAP support bluez.test.bot
2022-08-27  0:05 ` [PATCH v3 02/11] lib/uuid: Add PACS/ASCS UUIDs Luiz Augusto von Dentz
2022-08-27  0:05 ` [PATCH v3 03/11] shared/bap: Add initial code for handling BAP Luiz Augusto von Dentz
2022-08-27  0:05 ` [PATCH v3 04/11] profiles: Add initial code for bap plugin Luiz Augusto von Dentz
2022-08-27  0:05 ` [PATCH v3 05/11] shared: Add definition for LC3 codec Luiz Augusto von Dentz
2022-08-27  0:05 ` [PATCH v3 06/11] media-api: Add SelectProperties Luiz Augusto von Dentz
2022-08-27  0:05 ` [PATCH v3 07/11] test/simple-endpoint: Add support for LC3 endpoints Luiz Augusto von Dentz
2022-08-27  0:05 ` [PATCH v3 08/11] client/player: Add support for PACS endpoints Luiz Augusto von Dentz
2022-08-27  0:05 ` [PATCH v3 09/11] client/player: Use QoS interval on transport.send Luiz Augusto von Dentz
2022-08-27  0:05 ` [PATCH v3 10/11] profiles: Allow linked transport to release the fd Luiz Augusto von Dentz
2022-08-27  0:05 ` [PATCH v3 11/11] profiles: Update transport Links property on state change to QoS Luiz Augusto von Dentz
2022-08-29 19:50 ` [PATCH v3 00/11] Initial BAP support patchwork-bot+bluetooth
  -- strict thread matches above, loose matches on Subject: below --
2022-08-26 23:20 [PATCH v2 1/9] adapter: Add btd_adapter_find_device_by_fd Luiz Augusto von Dentz
2022-08-27  0:20 ` Initial BAP support bluez.test.bot
2022-08-17 23:41 [PATCH BlueZ 1/9] adapter: Add btd_adapter_find_device_by_fd Luiz Augusto von Dentz
2022-08-18  3:50 ` Initial BAP support 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