bazzite/spec_files/bluez/0014-shared-gatt-Add-env-variable-to-prefer-indication-ov.patch

33 lines
1.2 KiB
Diff
Raw Permalink Normal View History

2024-05-20 22:43:04 +00:00
From 3cb5de4dc38e1f4e707e49e94f887ba6dceecae6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Danis?= <frederic.danis@collabora.com>
Date: Tue, 6 Feb 2024 11:19:55 +0100
Subject: [PATCH] shared/gatt: Add env variable to prefer indication over
notification
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
GAP/SEC/SEM/BV-56-C, GAP/SEC/SEM/BV-57-C and GAP/SEC/SEM/BV-58-C require
to be able to request indication for a characteristic
---
src/shared/gatt-client.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index 6340bcd85..0f07ea7e8 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -1672,7 +1672,9 @@ static bool notify_data_write_ccc(struct notify_data *notify_data, bool enable,
/* Try to enable notifications or indications based on
* whatever the characteristic supports.
*/
- if (properties & BT_GATT_CHRC_PROP_NOTIFY)
+ if ((properties & BT_GATT_CHRC_PROP_INDICATE) && getenv("PREFER_INDICATION"))
+ value = cpu_to_le16(0x0002);
+ else if (properties & BT_GATT_CHRC_PROP_NOTIFY)
value = cpu_to_le16(0x0001);
else if (properties & BT_GATT_CHRC_PROP_INDICATE)
value = cpu_to_le16(0x0002);
--
2.34.1