[PATCH BlueZ] client/mgmt: Print UUID and flags when showing experimental features

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 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





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux