linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ bluez] client: Set the feature when initializing the client
@ 2025-02-08 11:40 Yang Li via B4 Relay
  2025-02-08 13:21 ` [BlueZ,bluez] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Li via B4 Relay @ 2025-02-08 11:40 UTC (permalink / raw)
  To: Linux Bluetooth; +Cc: Yang Li

From: Yang Li <yang.li@amlogic.com>

When writing Client Features feature values, it needs
to determine whether local eatt is enabled.

Signed-off-by: Yang Li <yang.li@amlogic.com>
---
 src/device.c             | 9 ++++++++-
 src/gatt-database.c      | 3 ++-
 src/shared/gatt-client.c | 8 +++++---
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/device.c b/src/device.c
index e8bff718c..dfa8b277e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -5628,6 +5628,8 @@ static void gatt_debug(const char *str, void *user_data)
 
 static void gatt_client_init(struct btd_device *device)
 {
+	uint8_t features;
+
 	gatt_client_cleanup(device);
 
 	if (!device->connect && !btd_opts.reverse_discovery) {
@@ -5639,8 +5641,13 @@ static void gatt_client_init(struct btd_device *device)
 		return;
 	}
 
+	features =  BT_GATT_CHRC_CLI_FEAT_ROBUST_CACHING
+				| BT_GATT_CHRC_CLI_FEAT_NFY_MULTI;
+	if (btd_opts.gatt_channels > 1)
+		features |= BT_GATT_CHRC_CLI_FEAT_EATT;
+
 	device->client = bt_gatt_client_new(device->db, device->att,
-							device->att_mtu, 0);
+							device->att_mtu, features);
 	if (!device->client) {
 		DBG("Failed to initialize");
 		return;
diff --git a/src/gatt-database.c b/src/gatt-database.c
index a5a01add4..1056b9797 100644
--- a/src/gatt-database.c
+++ b/src/gatt-database.c
@@ -1245,7 +1245,8 @@ static void server_feat_read_cb(struct gatt_db_attribute *attrib,
 		goto done;
 	}
 
-	value |= BT_GATT_CHRC_SERVER_FEAT_EATT;
+	if (btd_opts.gatt_channels > 1)
+		value |= BT_GATT_CHRC_SERVER_FEAT_EATT;
 
 done:
 	gatt_db_attribute_read_result(attrib, id, ecode, &value, sizeof(value));
diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index 9db3f5211..41a5c6f9c 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -2043,7 +2043,7 @@ static void write_client_features(struct bt_gatt_client *client)
 
 	handle = gatt_db_attribute_get_handle(attr);
 
-	client->features = BT_GATT_CHRC_CLI_FEAT_ROBUST_CACHING;
+	client->features |= BT_GATT_CHRC_CLI_FEAT_ROBUST_CACHING;
 
 	bt_uuid16_create(&uuid, GATT_CHARAC_SERVER_FEAT);
 
@@ -2055,10 +2055,12 @@ static void write_client_features(struct bt_gatt_client *client)
 		gatt_db_attribute_read(attr, 0, BT_ATT_OP_READ_REQ,
 						NULL, server_feat_read_value,
 						&feat);
-		if (feat && feat[0] & BT_GATT_CHRC_SERVER_FEAT_EATT)
-			client->features |= BT_GATT_CHRC_CLI_FEAT_EATT;
+		if (!(feat && feat[0] & BT_GATT_CHRC_SERVER_FEAT_EATT)
+			|| !(client->features & BT_GATT_CHRC_CLI_FEAT_EATT))
+			client->features &= ~BT_GATT_CHRC_CLI_FEAT_EATT;
 	}
 
+
 	client->features |= BT_GATT_CHRC_CLI_FEAT_NFY_MULTI;
 
 	DBG(client, "Writing Client Features 0x%02x", client->features);

---
base-commit: 2ee08ffd4d469781dc627fa50b4a015d9ad68007
change-id: 20250208-client_eatt-c715de38312f

Best regards,
-- 
Yang Li <yang.li@amlogic.com>



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

* RE: [BlueZ,bluez] client: Set the feature when initializing the client
  2025-02-08 11:40 [PATCH BlueZ bluez] client: Set the feature when initializing the client Yang Li via B4 Relay
@ 2025-02-08 13:21 ` bluez.test.bot
  0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2025-02-08 13:21 UTC (permalink / raw)
  To: linux-bluetooth, devnull+yang.li.amlogic.com

[-- Attachment #1: Type: text/plain, Size: 1260 bytes --]

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

---Test result---

Test Summary:
CheckPatch                    PENDING   0.25 seconds
GitLint                       PENDING   0.19 seconds
BuildEll                      PASS      20.13 seconds
BluezMake                     PASS      1500.00 seconds
MakeCheck                     PASS      13.10 seconds
MakeDistcheck                 PASS      155.66 seconds
CheckValgrind                 PASS      211.75 seconds
CheckSmatch                   PASS      281.19 seconds
bluezmakeextell               PASS      97.08 seconds
IncrementalBuild              PENDING   0.27 seconds
ScanBuild                     PASS      846.86 seconds

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

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

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


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

end of thread, other threads:[~2025-02-08 13:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-08 11:40 [PATCH BlueZ bluez] client: Set the feature when initializing the client Yang Li via B4 Relay
2025-02-08 13:21 ` [BlueZ,bluez] " 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;
as well as URLs for NNTP newsgroup(s).