2023-02-11 10:57:12

by Pauli Virtanen

[permalink] [raw]
Subject: [PATCH BlueZ v2 1/9] doc: remove unimplemented Quality Report from MGMT settings

The Set Quality Report command was removed in
commit 0454e2d09570 ("mgmt: Add support for Mesh in the kernel"),
but the settings bit was not removed. It's also not implemented on
kernel side, so remove it now.
---

Notes:
v2: split to two commits

doc/mgmt-api.txt | 2 --
1 file changed, 2 deletions(-)

diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
index 90d612ed8..0e0b4fdf0 100644
--- a/doc/mgmt-api.txt
+++ b/doc/mgmt-api.txt
@@ -332,7 +332,6 @@ Read Controller Information Command
15 Static Address
16 PHY Configuration
17 Wideband Speech
- 18 Quality Report

This command generates a Command Complete event on success or
a Command Status event on failure.
@@ -2925,7 +2924,6 @@ Read Extended Controller Information Command
15 Static Address
16 PHY Configuration
17 Wideband Speech
- 18 Quality Report

The EIR_Data field contains information about class of device,
local name and other values. Not all of them might be present. For
--
2.39.1



2023-02-11 10:57:12

by Pauli Virtanen

[permalink] [raw]
Subject: [PATCH BlueZ v2 2/9] doc: add MGMT setting for CIS features

Add definitions for new MGMT Controller Information settings bits,
indicating adapter Connected Isochronous Stream - Central/Peripheral
feature support.
---

Notes:
v2: split to two commits

doc/mgmt-api.txt | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
index 0e0b4fdf0..58395dc90 100644
--- a/doc/mgmt-api.txt
+++ b/doc/mgmt-api.txt
@@ -332,6 +332,8 @@ Read Controller Information Command
15 Static Address
16 PHY Configuration
17 Wideband Speech
+ 18 Connected Isochronous Stream - Central
+ 19 Connected Isochronous Stream - Peripheral

This command generates a Command Complete event on success or
a Command Status event on failure.
@@ -2924,6 +2926,8 @@ Read Extended Controller Information Command
15 Static Address
16 PHY Configuration
17 Wideband Speech
+ 18 Connected Isochronous Stream - Central
+ 19 Connected Isochronous Stream - Peripheral

The EIR_Data field contains information about class of device,
local name and other values. Not all of them might be present. For
--
2.39.1


2023-02-11 10:57:13

by Pauli Virtanen

[permalink] [raw]
Subject: [PATCH BlueZ v2 3/9] lib: Add defines for MGMT setting bits for CIS feature support

---

Notes:
v2: no changes

The kernel mgmt.h doesn't use BIT(n) macro here, so I didn't change that
now to keep these defines identical.

lib/mgmt.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/lib/mgmt.h b/lib/mgmt.h
index 796190cd9..efbdfb4b1 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
@@ -96,6 +96,8 @@ struct mgmt_rp_read_index_list {
#define MGMT_SETTING_STATIC_ADDRESS 0x00008000
#define MGMT_SETTING_PHY_CONFIGURATION 0x00010000
#define MGMT_SETTING_WIDEBAND_SPEECH 0x00020000
+#define MGMT_SETTING_CIS_CENTRAL 0x00040000
+#define MGMT_SETTING_CIS_PERIPHERAL 0x00080000

#define MGMT_OP_READ_INFO 0x0004
struct mgmt_rp_read_info {
--
2.39.1


2023-02-11 10:57:14

by Pauli Virtanen

[permalink] [raw]
Subject: [PATCH BlueZ v2 5/9] tools/btmgmt: add MGMT setting bit names for CIS feature support

Add names for CIS Central/Peripheral MGMT setting bits:

[mgmt]# info
Index list with 1 item
hci0: Primary controller
addr XX:XX:XX:XX:XX:XX version 12 manufacturer 2 class 0x7c0104
supported settings: powered connectable fast-connectable discoverable bondable link-security ssp br/edr le advertising secure-conn debug-keys privacy configuration static-addr phy-configuration wide-band-speech cis-central cis-peripheral
current settings: powered bondable ssp br/edr le secure-conn cis-central cis-peripheral
name xxx
short name
hci0: Configuration options
supported options: public-address
missing options:
---

Notes:
v2: add example command output

tools/btmgmt.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 29f86091f..323c26712 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -353,6 +353,8 @@ static const char *settings_str[] = {
"static-addr",
"phy-configuration",
"wide-band-speech",
+ "cis-central",
+ "cis-peripheral",
};

static const char *settings2str(uint32_t settings)
--
2.39.1


2023-02-11 10:57:13

by Pauli Virtanen

[permalink] [raw]
Subject: [PATCH BlueZ v2 4/9] monitor: add MGMT setting bit names for CIS feature support

Add names for CIS Central/Peripheral MGMT bits:

@ MGMT Event: Command Complete (0x0001) plen 283 {0x0002} [hci0] 3.745117
Read Controller Information (0x0004) plen 280
Status: Success (0x00)
Address: XX:XX:XX:XX:XX:XX (Intel Corporate)
Version: Bluetooth 5.3 (0x0c)
Manufacturer: Intel Corp. (2)
Supported settings: 0x000ffeff
Powered
Connectable
Fast Connectable
Discoverable
Bondable
Link Security
Secure Simple Pairing
BR/EDR
Low Energy
Advertising
Secure Connections
Debug Keys
Privacy
Controller Configuration
Static Address
PHY Configuration
Wideband Speech
CIS Central
CIS Peripheral
Current settings: 0x000c0ad1
Powered
Bondable
Secure Simple Pairing
BR/EDR
Low Energy
Secure Connections
CIS Central
CIS Peripheral
Class: 0x7c0104
Major class: Computer (desktop, notebook, PDA, organizers)
Minor class: Desktop workstation
Rendering (Printing, Speaker)
Capturing (Scanner, Microphone)
Object Transfer (v-Inbox, v-Folder)
Audio (Speaker, Microphone, Headset)
Telephony (Cordless telephony, Modem, Headset)
Name: xxx
Short name:
---

Notes:
v2: add example output

monitor/packet.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/monitor/packet.c b/monitor/packet.c
index 44f1941bd..d9e8abf41 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -12649,6 +12649,8 @@ static const struct bitfield_data mgmt_settings_table[] = {
{ 15, "Static Address" },
{ 16, "PHY Configuration" },
{ 17, "Wideband Speech" },
+ { 18, "CIS Central" },
+ { 19, "CIS Peripheral" },
{ }
};

--
2.39.1


2023-02-11 10:57:15

by Pauli Virtanen

[permalink] [raw]
Subject: [PATCH BlueZ v2 6/9] adapter: add function for checking adapter features, add CIS features

Add function for checking adapter features, similar to
btd_has_kernel_features. Currently supports the CIS feature bits.
---

Notes:
v2: use feature flags, not separate functions

src/adapter.c | 13 +++++++++++++
src/adapter.h | 7 +++++++
2 files changed, 20 insertions(+)

diff --git a/src/adapter.c b/src/adapter.c
index aadad4016..4ccacdb8b 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -10712,6 +10712,19 @@ bool btd_le_connect_before_pairing(void)
return false;
}

+bool btd_adapter_has_features(struct btd_adapter *adapter, uint32_t features)
+{
+ uint32_t flags = 0;
+
+ if (adapter->current_settings & MGMT_SETTING_CIS_CENTRAL)
+ flags |= ADAPTER_CIS_CENTRAL;
+
+ if (adapter->current_settings & MGMT_SETTING_CIS_PERIPHERAL)
+ flags |= ADAPTER_CIS_PERIPHERAL;
+
+ return (flags & features) ? true : false;
+}
+
bool btd_has_kernel_features(uint32_t features)
{
return (kernel_features & features) ? true : false;
diff --git a/src/adapter.h b/src/adapter.h
index 78eb069ae..96a8668d5 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -256,6 +256,13 @@ void btd_adapter_for_each_device(struct btd_adapter *adapter,

bool btd_le_connect_before_pairing(void);

+enum adapter_features {
+ ADAPTER_CIS_CENTRAL = 1 << 0,
+ ADAPTER_CIS_PERIPHERAL = 1 << 1,
+};
+
+bool btd_adapter_has_features(struct btd_adapter *adapter, uint32_t features);
+
enum experimental_features {
EXP_FEAT_DEBUG = 1 << 0,
EXP_FEAT_LE_SIMULT_ROLES = 1 << 1,
--
2.39.1


2023-02-11 10:57:16

by Pauli Virtanen

[permalink] [raw]
Subject: [PATCH BlueZ v2 7/9] media: Check adapter CIS support to add BAP in SupportedUUIDs

Don't indicate BAP support in SupportedUUIDs, if adapter supports
neither CIS Central nor Peripheral.
---

Notes:
v2: use btd_adapter_has_features

profiles/audio/media.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 505c4b3a6..0e0c40dc7 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -1279,6 +1279,10 @@ static bool experimental_endpoint_supported(struct btd_adapter *adapter)
if (!btd_adapter_has_exp_feature(adapter, EXP_FEAT_ISO_SOCKET))
return false;

+ if (!btd_adapter_has_features(adapter, ADAPTER_CIS_CENTRAL) &&
+ !btd_adapter_has_features(adapter, ADAPTER_CIS_PERIPHERAL))
+ return false;
+
return g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL;
}

--
2.39.1


2023-02-11 10:57:17

by Pauli Virtanen

[permalink] [raw]
Subject: [PATCH BlueZ v2 8/9] shared/bap: support client-only case

When client-only, skip registering ASCS and PACS in the local GATT DB.

The data structures used to track the local ASE & PAC registrations and
ASE state are then also not needed, and are set to NULL in this case.

In this case, local "endpoints" exist only in the form of locally added
bt_bap_pac PAC data. These usually are in 1-to-1 correspondence with the
Media1 API endpoints registered by media applications.
---

Notes:
v2:
* Use named boolean flag for client-only in bt_bap_db instead of just
NULL field values, maybe makes the intent a bit clearer.
* Add bt_bap_set_client_only for setting the client-only flag on
databases, instead of exposing bt_bap_db.

The client-only state cannot be indicated to bt_bap_new by passing in
ldb==NULL, because the local PACs are in the ldb and we need to know
which adapter the bt_bap is for.

So instead use a separate function that sets the flag. It cannot make
already peripheral-enabled DB client-only (currently), but this is not
needed now, and maybe not in the future either.

src/shared/bap.c | 42 +++++++++++++++++++++++++++++++++---------
src/shared/bap.h | 2 ++
2 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 22f2e6714..e85815d8d 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -109,6 +109,7 @@ struct bt_ascs {
};

struct bt_bap_db {
+ bool client_only;
struct gatt_db *db;
struct bt_pacs *pacs;
struct bt_ascs *ascs;
@@ -620,7 +621,7 @@ static struct bt_bap_endpoint *bap_get_endpoint(struct bt_bap_db *db,
{
struct bt_bap_endpoint *ep;

- if (!db || !attr)
+ if (!db || !attr || db->client_only)
return NULL;

ep = queue_find(db->endpoints, bap_endpoint_match, attr);
@@ -652,7 +653,7 @@ static struct bt_bap_endpoint *bap_get_endpoint_id(struct bt_bap *bap,
struct gatt_db_attribute *attr = NULL;
size_t i;

- if (!bap || !db)
+ if (!bap || !db || db->client_only)
return NULL;

ep = queue_find(db->endpoints, bap_endpoint_match_id, UINT_TO_PTR(id));
@@ -2170,7 +2171,7 @@ static struct bt_ascs *ascs_new(struct gatt_db *db)
return ascs;
}

-static struct bt_bap_db *bap_db_new(struct gatt_db *db)
+static struct bt_bap_db *bap_db_new(struct gatt_db *db, bool client_only)
{
struct bt_bap_db *bdb;

@@ -2178,19 +2179,23 @@ static struct bt_bap_db *bap_db_new(struct gatt_db *db)
return NULL;

bdb = new0(struct bt_bap_db, 1);
+ bdb->client_only = client_only;
bdb->db = gatt_db_ref(db);
bdb->sinks = queue_new();
bdb->sources = queue_new();
- bdb->endpoints = queue_new();

if (!bap_db)
bap_db = queue_new();

- bdb->pacs = pacs_new(db);
- bdb->pacs->bdb = bdb;
+ if (!client_only) {
+ bdb->endpoints = queue_new();
+
+ bdb->pacs = pacs_new(db);
+ bdb->pacs->bdb = bdb;

- bdb->ascs = ascs_new(db);
- bdb->ascs->bdb = bdb;
+ bdb->ascs = ascs_new(db);
+ bdb->ascs->bdb = bdb;
+ }

queue_push_tail(bap_db, bdb);

@@ -2205,7 +2210,20 @@ static struct bt_bap_db *bap_get_db(struct gatt_db *db)
if (bdb)
return bdb;

- return bap_db_new(db);
+ return bap_db_new(db, false);
+}
+
+int bt_bap_set_client_only(struct gatt_db *db)
+{
+ struct bt_bap_db *bdb;
+
+ bdb = queue_find(bap_db, bap_db_match, db);
+ if (bdb)
+ return bdb->client_only ? 0 : -EINVAL;
+
+ bap_db_new(db, true);
+
+ return 0;
}

static struct bt_pacs *bap_get_pacs(struct bt_bap *bap)
@@ -2328,6 +2346,9 @@ static void bap_add_sink(struct bt_bap_pac *pac)

queue_push_tail(pac->bdb->sinks, pac);

+ if (pac->bdb->client_only)
+ return;
+
memset(value, 0, sizeof(value));

iov.iov_base = value;
@@ -2346,6 +2367,9 @@ static void bap_add_source(struct bt_bap_pac *pac)

queue_push_tail(pac->bdb->sources, pac);

+ if (pac->bdb->client_only)
+ return;
+
memset(value, 0, sizeof(value));

iov.iov_base = value;
diff --git a/src/shared/bap.h b/src/shared/bap.h
index 47a15636c..90d373e35 100644
--- a/src/shared/bap.h
+++ b/src/shared/bap.h
@@ -111,6 +111,8 @@ struct bt_bap_pac *bt_bap_add_pac(struct gatt_db *db, const char *name,
struct iovec *data,
struct iovec *metadata);

+int bt_bap_set_client_only(struct gatt_db *db);
+
struct bt_bap_pac_ops {
int (*select)(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
struct bt_bap_pac_qos *qos,
--
2.39.1


2023-02-11 10:57:18

by Pauli Virtanen

[permalink] [raw]
Subject: [PATCH BlueZ v2 9/9] bap: handle adapters that are not CIS Central / Peripheral capable

When BT adapter is not CIS Peripheral capable, set client-only for the
local db, so that ASCS/PACS are not registered.

When BT adapter is not CIS Central capable, ignore the remote device
GATT database, and don't start client sessions.
---

Notes:
v2:
* Use bt_bap_set_client_only and btd_adapter_has_features to do the
stuff.
* Don't attach client in bap_accept, if adapter doesn't support
CIS Central.

We still mark the service as connected. If we want to mark the
service unavailable in this case, we could return error in
device_probe. Server connections are handled in bap_attached/detached
and work also in this case, this should work based on looking at the
code, and it works in testing.

The patch series was manually tested with two machines running it, with
Central flag forced to false on one end, and Peripheral flag to false on
the other, and testing Pipewire being able to play + record audio over
the BAP link.

Playback + recording on non-BlueZ remote device was also tested with
Peripheral flag disabled.

bluetoothctl:

Server (CIS Central bit disabled):

[bluetooth]# endpoint.register 00002bc9-0000-1000-8000-00805f9b34fb 0x06
[/local/endpoint/ep0] Auto Accept (yes/no): yes
[/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): yes
[/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]# show
Controller XX:XX:XX:XX:XX:XX (public)
Name: xxx
Alias: xxx
Class: 0x00000000
Powered: yes
PowerState: on
Discoverable: no
DiscoverableTimeout: 0x000000b4
Pairable: no
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Volume Control (00001844-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
UUID: Audio Stream Control (0000184e-0000-1000-8000-00805f9b34fb)
UUID: Published Audio Capabil.. (00001850-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0542
Discovering: no
Roles: central
Roles: peripheral
ExperimentalFeatures: BlueZ Experimental LL p.. (15c0a148-c273-11ea-b3de-0242ac130004)
ExperimentalFeatures: BlueZ Experimental Blue.. (330859bc-7506-492d-9370-9a6f0614037f)
ExperimentalFeatures: BlueZ Experimental ISO... (6fbaf188-05e0-496a-9885-d6ddfdb4e03e)

Client (CIS Peripheral bit disabled):

[bluetooth]# endpoint.register 00002bc9-0000-1000-8000-00805f9b34fb 0x06
[/local/endpoint/ep0] Auto Accept (yes/no): yes
[/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): yes
[/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]# show
Controller YY:YY:YY:YY:YY:YY (public)
Name: yyy
Alias: yyy
Class: 0x00000000
Powered: yes
PowerState: on
Discoverable: no
DiscoverableTimeout: 0x000000b4
Pairable: no
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Volume Control (00001844-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0542
Discovering: no
Roles: central
Roles: peripheral
ExperimentalFeatures: BlueZ Experimental ISO... (6fbaf188-05e0-496a-9885-d6ddfdb4e03e)

The client is client-only, and has no ASCS/PACS.

[bluetooth]# connect XX:XX:XX:XX:XX:XX
...
[server]# transport.list
Transport /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_source0/fd12
Transport /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_sink0/fd13
[server]# endpoint.list
Endpoint /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_source0
Endpoint /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_sink0
[server]# endpoint.list local
/local/endpoint/ep0
/local/endpoint/ep1
[server]# transport.acquire /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_source0/fd12
Acquire successful: fd 7 MTU 40:40
[CHG] Transport /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_sink0/fd13 State: active
[CHG] Transport /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_source0/fd12 State: active

Server:

Auto Acquiring...
[CHG] Transport /org/bluez/hci0/dev_YY_YY_YY_YY_YY_YY/fd6 State: pending
Acquire successful: fd 7 MTU 40:40
[CHG] Transport /org/bluez/hci0/dev_YY_YY_YY_YY_YY_YY/fd7 State: active
[CHG] Transport /org/bluez/hci0/dev_YY_YY_YY_YY_YY_YY/fd6 State: active
[client]# endpoint.list
[client]# endpoint.list local
/local/endpoint/ep0
/local/endpoint/ep1

The server is peripheral-only and has only local endpoints.

profiles/audio/bap.c | 26 ++++++++++++++++++++++++--
profiles/audio/media.c | 6 +++++-
2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index b8c75f195..426aa89aa 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -1259,6 +1259,7 @@ static int bap_probe(struct btd_service *service)
struct btd_adapter *adapter = device_get_adapter(device);
struct btd_gatt_database *database = btd_adapter_get_database(adapter);
struct bap_data *data = btd_service_get_user_data(service);
+ struct gatt_db *adapter_db, *device_db;
char addr[18];

ba2str(device_get_address(device), addr);
@@ -1269,17 +1270,32 @@ static int bap_probe(struct btd_service *service)
return -ENOTSUP;
}

+ if (!btd_adapter_has_features(adapter, ADAPTER_CIS_CENTRAL) &&
+ !btd_adapter_has_features(adapter, ADAPTER_CIS_PERIPHERAL)) {
+ DBG("BAP requires CIS features, unsupported by adapter");
+ return -ENOTSUP;
+ }
+
/* Ignore, if we were probed for this device already */
if (data) {
error("Profile probed twice for the same device!");
return -EINVAL;
}

+ adapter_db = btd_gatt_database_get_db(database);
+
+ if (!btd_adapter_has_features(adapter, ADAPTER_CIS_PERIPHERAL))
+ bt_bap_set_client_only(adapter_db);
+
+ if (btd_adapter_has_features(adapter, ADAPTER_CIS_CENTRAL))
+ device_db = btd_device_get_gatt_db(device);
+ else
+ device_db = NULL;
+
data = bap_data_new(device);
data->service = service;

- data->bap = bt_bap_new(btd_gatt_database_get_db(database),
- btd_device_get_gatt_db(device));
+ data->bap = bt_bap_new(adapter_db, device_db);
if (!data->bap) {
error("Unable to create BAP instance");
free(data);
@@ -1303,6 +1319,7 @@ static int bap_probe(struct btd_service *service)
static int bap_accept(struct btd_service *service)
{
struct btd_device *device = btd_service_get_device(service);
+ struct btd_adapter *adapter = device_get_adapter(device);
struct bt_gatt_client *client = btd_device_get_gatt_client(device);
struct bap_data *data = btd_service_get_user_data(service);
char addr[18];
@@ -1315,6 +1332,11 @@ static int bap_accept(struct btd_service *service)
return -EINVAL;
}

+ if (!btd_adapter_has_features(adapter, ADAPTER_CIS_CENTRAL)) {
+ btd_service_connecting_complete(service, 0);
+ return 0;
+ }
+
if (!bt_bap_attach(data->bap, client)) {
error("BAP unable to attach");
return -EINVAL;
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 0e0c40dc7..d9e133007 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -1110,6 +1110,7 @@ static void bap_debug(const char *str, void *user_data)
static bool endpoint_init_pac(struct media_endpoint *endpoint, uint8_t type,
int *err)
{
+ struct btd_adapter *adapter = endpoint->adapter->btd_adapter;
struct btd_gatt_database *database;
struct gatt_db *db;
struct iovec data;
@@ -1122,7 +1123,7 @@ static bool endpoint_init_pac(struct media_endpoint *endpoint, uint8_t type,
return false;
}

- database = btd_adapter_get_database(endpoint->adapter->btd_adapter);
+ database = btd_adapter_get_database(adapter);
if (!database) {
error("Adapter database not found");
return false;
@@ -1158,6 +1159,9 @@ static bool endpoint_init_pac(struct media_endpoint *endpoint, uint8_t type,
metadata->iov_len = endpoint->metadata_size;
}

+ if (!btd_adapter_has_features(adapter, ADAPTER_CIS_PERIPHERAL))
+ bt_bap_set_client_only(db);
+
endpoint->pac = bt_bap_add_vendor_pac(db, name, type, endpoint->codec,
endpoint->cid, endpoint->vid, &endpoint->qos,
&data, metadata);
--
2.39.1


2023-02-11 13:45:22

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ,v2,1/9] doc: remove unimplemented Quality Report from MGMT settings

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

---Test result---

Test Summary:
CheckPatch FAIL 4.60 seconds
GitLint FAIL 3.23 seconds
BuildEll PASS 26.90 seconds
BluezMake PASS 865.81 seconds
MakeCheck PASS 11.33 seconds
MakeDistcheck PASS 148.69 seconds
CheckValgrind PASS 244.11 seconds
CheckSmatch WARNING 328.31 seconds
bluezmakeextell PASS 97.56 seconds
IncrementalBuild PASS 6443.84 seconds
ScanBuild PASS 996.32 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,v2,1/9] doc: remove unimplemented Quality Report from MGMT settings
WARNING:UNKNOWN_COMMIT_ID: Unknown commit id '0454e2d09570', maybe rebased or not pulled?
#48:
commit 0454e2d09570 ("mgmt: Add support for Mesh in the kernel"),

/github/workspace/src/src/13136997.patch total: 0 errors, 1 warnings, 14 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13136997.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.


[BlueZ,v2,5/9] tools/btmgmt: add MGMT setting bit names for CIS feature support
WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#56:
supported settings: powered connectable fast-connectable discoverable bondable link-security ssp br/edr le advertising secure-conn debug-keys privacy configuration static-addr phy-configuration wide-band-speech cis-central cis-peripheral

/github/workspace/src/src/13137000.patch total: 0 errors, 1 warnings, 8 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13137000.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v2,3/9] lib: Add defines for MGMT setting bits for CIS feature support

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
7: B2 Line has trailing whitespace: " "
[BlueZ,v2,5/9] tools/btmgmt: add MGMT setting bit names for CIS feature support

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
7: B3 Line contains hard tab characters (\t): "hci0: Primary controller"
8: B3 Line contains hard tab characters (\t): " addr XX:XX:XX:XX:XX:XX version 12 manufacturer 2 class 0x7c0104"
9: B1 Line exceeds max length (238>80): " supported settings: powered connectable fast-connectable discoverable bondable link-security ssp br/edr le advertising secure-conn debug-keys privacy configuration static-addr phy-configuration wide-band-speech cis-central cis-peripheral"
9: B3 Line contains hard tab characters (\t): " supported settings: powered connectable fast-connectable discoverable bondable link-security ssp br/edr le advertising secure-conn debug-keys privacy configuration static-addr phy-configuration wide-band-speech cis-central cis-peripheral"
10: B1 Line exceeds max length (88>80): " current settings: powered bondable ssp br/edr le secure-conn cis-central cis-peripheral"
10: B3 Line contains hard tab characters (\t): " current settings: powered bondable ssp br/edr le secure-conn cis-central cis-peripheral"
11: B3 Line contains hard tab characters (\t): " name xxx"
12: B3 Line contains hard tab characters (\t): " short name"
13: B3 Line contains hard tab characters (\t): "hci0: Configuration options"
14: B3 Line contains hard tab characters (\t): " supported options: public-address"
15: B3 Line contains hard tab characters (\t): " missing options:"
[BlueZ,v2,6/9] adapter: add function for checking adapter features, add CIS features

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T1 Title exceeds max length (84>80): "[BlueZ,v2,6/9] adapter: add function for checking adapter features, add CIS features"
[BlueZ,v2,8/9] shared/bap: support client-only case

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
19: B2 Line has trailing whitespace: " "
23: B2 Line has trailing whitespace: " "
[BlueZ,v2,9/9] bap: handle adapters that are not CIS Central / Peripheral capable

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T1 Title exceeds max length (81>80): "[BlueZ,v2,9/9] bap: handle adapters that are not CIS Central / Peripheral capable"
16: B2 Line has trailing whitespace: " "
22: B2 Line has trailing whitespace: " "
27: B2 Line has trailing whitespace: " "
30: B2 Line has trailing whitespace: " "
32: B2 Line has trailing whitespace: " "
34: B2 Line has trailing whitespace: " "
51: B3 Line contains hard tab characters (\t): " Name: xxx"
52: B3 Line contains hard tab characters (\t): " Alias: xxx"
53: B3 Line contains hard tab characters (\t): " Class: 0x00000000"
54: B3 Line contains hard tab characters (\t): " Powered: yes"
55: B3 Line contains hard tab characters (\t): " PowerState: on"
56: B3 Line contains hard tab characters (\t): " Discoverable: no"
57: B3 Line contains hard tab characters (\t): " DiscoverableTimeout: 0x000000b4"
58: B3 Line contains hard tab characters (\t): " Pairable: no"
59: B3 Line contains hard tab characters (\t): " UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)"
60: B3 Line contains hard tab characters (\t): " UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)"
61: B3 Line contains hard tab characters (\t): " UUID: Volume Control (00001844-0000-1000-8000-00805f9b34fb)"
62: B3 Line contains hard tab characters (\t): " UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)"
63: B3 Line contains hard tab characters (\t): " UUID: Audio Stream Control (0000184e-0000-1000-8000-00805f9b34fb)"
64: B3 Line contains hard tab characters (\t): " UUID: Published Audio Capabil.. (00001850-0000-1000-8000-00805f9b34fb)"
65: B3 Line contains hard tab characters (\t): " Modalias: usb:v1D6Bp0246d0542"
66: B3 Line contains hard tab characters (\t): " Discovering: no"
67: B3 Line contains hard tab characters (\t): " Roles: central"
68: B3 Line contains hard tab characters (\t): " Roles: peripheral"
69: B1 Line exceeds max length (91>80): " ExperimentalFeatures: BlueZ Experimental LL p.. (15c0a148-c273-11ea-b3de-0242ac130004)"
69: B3 Line contains hard tab characters (\t): " ExperimentalFeatures: BlueZ Experimental LL p.. (15c0a148-c273-11ea-b3de-0242ac130004)"
70: B1 Line exceeds max length (91>80): " ExperimentalFeatures: BlueZ Experimental Blue.. (330859bc-7506-492d-9370-9a6f0614037f)"
70: B3 Line contains hard tab characters (\t): " ExperimentalFeatures: BlueZ Experimental Blue.. (330859bc-7506-492d-9370-9a6f0614037f)"
71: B1 Line exceeds max length (91>80): " ExperimentalFeatures: BlueZ Experimental ISO... (6fbaf188-05e0-496a-9885-d6ddfdb4e03e)"
71: B3 Line contains hard tab characters (\t): " ExperimentalFeatures: BlueZ Experimental ISO... (6fbaf188-05e0-496a-9885-d6ddfdb4e03e)"
72: B2 Line has trailing whitespace: " "
74: B2 Line has trailing whitespace: " "
99: B1 Line exceeds max length (82>80): " UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)"
100: B1 Line exceeds max length (82>80): " UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)"
101: B1 Line exceeds max length (82>80): " UUID: Volume Control (00001844-0000-1000-8000-00805f9b34fb)"
102: B1 Line exceeds max length (82>80): " UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)"
107: B1 Line exceeds max length (98>80): " ExperimentalFeatures: BlueZ Experimental ISO... (6fbaf188-05e0-496a-9885-d6ddfdb4e03e)"
108: B2 Line has trailing whitespace: " "
110: B2 Line has trailing whitespace: " "
122: B1 Line exceeds max length (90>80): " [server]# transport.acquire /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_source0/fd12"
124: B1 Line exceeds max length (90>80): " [CHG] Transport /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_sink0/fd13 State: active"
125: B1 Line exceeds max length (92>80): " [CHG] Transport /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_source0/fd12 State: active"
126: B2 Line has trailing whitespace: " "
128: B2 Line has trailing whitespace: " "
138: B2 Line has trailing whitespace: " "
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
monitor/packet.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c:1799:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3551:52: warning: array of flexible structuresmonitor/bt.h:3539:40: warning: array of flexible structures


---
Regards,
Linux Bluetooth

2023-02-13 22:20:20

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH BlueZ v2 1/9] doc: remove unimplemented Quality Report from MGMT settings

Hello:

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

On Sat, 11 Feb 2023 10:53:45 +0000 you wrote:
> The Set Quality Report command was removed in
> commit 0454e2d09570 ("mgmt: Add support for Mesh in the kernel"),
> but the settings bit was not removed. It's also not implemented on
> kernel side, so remove it now.
> ---
>
> Notes:
> v2: split to two commits
>
> [...]

Here is the summary with links:
- [BlueZ,v2,1/9] doc: remove unimplemented Quality Report from MGMT settings
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=3e2e3aa73904
- [BlueZ,v2,2/9] doc: add MGMT setting for CIS features
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=97ad0ecbfdd4
- [BlueZ,v2,3/9] lib: Add defines for MGMT setting bits for CIS feature support
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=c35d32b19989
- [BlueZ,v2,4/9] monitor: add MGMT setting bit names for CIS feature support
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=0f2f7a8fe270
- [BlueZ,v2,5/9] tools/btmgmt: add MGMT setting bit names for CIS feature support
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=6f131929b832
- [BlueZ,v2,6/9] adapter: add function for checking adapter features, add CIS features
(no matching commit)
- [BlueZ,v2,7/9] media: Check adapter CIS support to add BAP in SupportedUUIDs
(no matching commit)
- [BlueZ,v2,8/9] shared/bap: support client-only case
(no matching commit)
- [BlueZ,v2,9/9] bap: handle adapters that are not CIS Central / Peripheral capable
(no matching commit)

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



2023-02-13 22:31:21

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH BlueZ v2 1/9] doc: remove unimplemented Quality Report from MGMT settings

Hi Pauli,

On Mon, Feb 13, 2023 at 2:21 PM <[email protected]> wrote:
>
> Hello:
>
> This series was applied to bluetooth/bluez.git (master)
> by Luiz Augusto von Dentz <[email protected]>:
>
> On Sat, 11 Feb 2023 10:53:45 +0000 you wrote:
> > The Set Quality Report command was removed in
> > commit 0454e2d09570 ("mgmt: Add support for Mesh in the kernel"),
> > but the settings bit was not removed. It's also not implemented on
> > kernel side, so remove it now.
> > ---
> >
> > Notes:
> > v2: split to two commits
> >
> > [...]
>
> Here is the summary with links:
> - [BlueZ,v2,1/9] doc: remove unimplemented Quality Report from MGMT settings
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=3e2e3aa73904
> - [BlueZ,v2,2/9] doc: add MGMT setting for CIS features
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=97ad0ecbfdd4
> - [BlueZ,v2,3/9] lib: Add defines for MGMT setting bits for CIS feature support
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=c35d32b19989
> - [BlueZ,v2,4/9] monitor: add MGMT setting bit names for CIS feature support
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=0f2f7a8fe270
> - [BlueZ,v2,5/9] tools/btmgmt: add MGMT setting bit names for CIS feature support
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=6f131929b832
> - [BlueZ,v2,6/9] adapter: add function for checking adapter features, add CIS features
> (no matching commit)
> - [BlueZ,v2,7/9] media: Check adapter CIS support to add BAP in SupportedUUIDs
> (no matching commit)
> - [BlueZ,v2,8/9] shared/bap: support client-only case
> (no matching commit)
> - [BlueZ,v2,9/9] bap: handle adapters that are not CIS Central / Peripheral capable
> (no matching commit)
>
> You are awesome, thank you!

Note that I did change some of the commits, for instance I went with
btd_adapter_has_settings so we can use the MGMT defines directly,
instead of creating a new enum.

--
Luiz Augusto von Dentz