public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] client/mgmt: Print UUID and flags when showing experimental features
@ 2025-07-19  7:05 Yao Zi
  2025-07-19  8:44 ` [BlueZ] " bluez.test.bot
  2025-07-24 20:40 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Yao Zi @ 2025-07-19  7:05 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Marcel Holtmann, Yao Zi

Command expinfo in mgmt menu queries experimental features from kernel
with MGMT_OP_READ_EXP_FEATURES_INFO. However, currently only the number
of experimental features are shown,

	> expinfo
	Global
	        Number of experimental features: 1
	Primary controller (hci0)
	        Number of experimental features: 4

and lacking of details makes the command less useful. To ease debug,
this patch introduces extra output for the expinfo command, showing UUID
and flags of experimental features as well. A typical output will look
like,

	> expinfo
	Global
	        Number of experimental features: 1
	        6fbaf188-05e0-496a-9885-d6ddfdb4e03e (flags 0x0000)
	Primary controller (hci0)
	        Number of experimental features: 4
	        671b10b5-42c0-4696-9227-eb28d1b049d6 (flags 0x0000)
	        330859bc-7506-492d-9370-9a6f0614037f (flags 0x0000)
	        6fbaf188-05e0-496a-9885-d6ddfdb4e03e (flags 0x0000)
	        2ce463d7-7a03-4d8d-bf05-5f24e8f36e76 (flags 0x0000)

Signed-off-by: Yao Zi <ziyao@disroot.org>
---
 client/mgmt.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/client/mgmt.c b/client/mgmt.c
index d07f7d8c0ea3..f1d607283da5 100644
--- a/client/mgmt.c
+++ b/client/mgmt.c
@@ -1699,7 +1699,10 @@ static void exp_info_rsp(uint8_t status, uint16_t len, const void *param,
 							void *user_data)
 {
 	const struct mgmt_rp_read_exp_features_info *rp = param;
-	uint16_t index = PTR_TO_UINT(user_data);
+	uint16_t index = PTR_TO_UINT(user_data), i;
+	uint128_t uuid_be;
+	char uuidstr[40];
+	bt_uuid_t uuid;
 
 	if (status != 0) {
 		error("Reading hci%u exp features failed with status 0x%02x (%s)",
@@ -1720,6 +1723,14 @@ static void exp_info_rsp(uint8_t status, uint16_t len, const void *param,
 	print("\tNumber of experimental features: %u",
 					le16_to_cpu(rp->feature_count));
 
+	uuid.type = BT_UUID128;
+	for (i = 0; i < le16_to_cpu(rp->feature_count); i++) {
+		memcpy(&uuid_be, &rp->features[i].uuid, sizeof(uint128_t));
+		ntoh128(&uuid_be, &uuid.value.u128);
+		bt_uuid_to_string(&uuid, uuidstr, sizeof(uuidstr));
+
+		print("\t%s (flags 0x%04x)", uuidstr, rp->features[i].flags);
+	}
 done:
 	pending_index--;
 
-- 
2.50.1


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

end of thread, other threads:[~2025-07-24 20:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-19  7:05 [PATCH BlueZ] client/mgmt: Print UUID and flags when showing experimental features Yao Zi
2025-07-19  8:44 ` [BlueZ] " bluez.test.bot
2025-07-24 20:40 ` [PATCH BlueZ] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox