diff mbox series

[BlueZ,v6,2/3] adapter: read quality report feature

Message ID 20210715174945.BlueZ.v6.2.I7d16f055bc51ac86915c114c671743f49a1fc226@changeid (mailing list archive)
State Accepted
Delegated to: Luiz Von Dentz
Headers show
Series [BlueZ,v6,1/3] monitor: add new Intel extended telemetry events | expand

Commit Message

Joseph Hwang July 15, 2021, 9:50 a.m. UTC
This patch adds a new UUID for the quality report experimental
feature. When reading the experimental features, it checks if
the new feature is supported by the controller and stores the
value in the quality_report_supported flag of the adapter.

The quality_report_supported flag could be used by the bluetoothd
to determine if the quality report feature can be enabled.

Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
---

Changes in v6:
- Add support for decoding the new bqr UUID on src/shared/util.c.

 src/adapter.c     | 16 ++++++++++++++++
 src/shared/util.c |  2 ++
 2 files changed, 18 insertions(+)
diff mbox series

Patch

diff --git a/src/adapter.c b/src/adapter.c
index 84bc5a1b0..12e4ff5c0 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -284,6 +284,7 @@  struct btd_adapter {
 	bool is_default;		/* true if adapter is default one */
 
 	bool le_simult_roles_supported;
+	bool quality_report_supported;
 };
 
 typedef enum {
@@ -9234,6 +9235,12 @@  static const uint8_t le_simult_central_peripheral_uuid[16] = {
 	0x96, 0x46, 0xc0, 0x42, 0xb5, 0x10, 0x1b, 0x67,
 };
 
+/* 330859bc-7506-492d-9370-9a6f0614037f */
+static const uint8_t quality_report_uuid[16] = {
+	0x7f, 0x03, 0x14, 0x06, 0x6f, 0x9a, 0x70, 0x93,
+	0x2d, 0x49, 0x06, 0x75, 0xbc, 0x59, 0x08, 0x33,
+};
+
 /* 15c0a148-c273-11ea-b3de-0242ac130004 */
 static const uint8_t rpa_resolution_uuid[16] = {
 	0x04, 0x00, 0x13, 0xac, 0x42, 0x02, 0xde, 0xb3,
@@ -9277,6 +9284,14 @@  static void le_simult_central_peripheral_func(struct btd_adapter *adapter,
 	adapter->le_simult_roles_supported = flags & 0x01;
 }
 
+static void quality_report_func(struct btd_adapter *adapter, uint32_t flags)
+{
+	adapter->quality_report_supported = le32_to_cpu(flags) & 0x01;
+
+	btd_info(adapter->dev_id, "quality_report_supported %d",
+			adapter->quality_report_supported);
+}
+
 static void set_rpa_resolution_complete(uint8_t status, uint16_t len,
 					const void *param, void *user_data)
 {
@@ -9315,6 +9330,7 @@  static const struct exp_feat {
 	EXP_FEAT(debug_uuid, exp_debug_func),
 	EXP_FEAT(le_simult_central_peripheral_uuid,
 		 le_simult_central_peripheral_func),
+	EXP_FEAT(quality_report_uuid, quality_report_func),
 	EXP_FEAT(rpa_resolution_uuid, rpa_resolution_func),
 };
 
diff --git a/src/shared/util.c b/src/shared/util.c
index 8c216f936..854b48d38 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -1025,6 +1025,8 @@  static const struct {
 		"BlueZ Experimental Simultaneous Central and Peripheral" },
 	{ "15c0a148-c273-11ea-b3de-0242ac130004",
 		"BlueZ Experimental LL privacy" },
+	{ "330859bc-7506-492d-9370-9a6f0614037f",
+		"BlueZ Experimental Bluetooth Quality Report" },
 	{ }
 };