Diff between b3d8d96823f4bfe785a7eb519a69285fb4058c24 and ba739af87d2ebb85355cd3768fbd6ff540d2940f

Changed Files

File Additions Deletions Status
monitor/main.c +17 -0 modified

Full Patch

diff --git a/monitor/main.c b/monitor/main.c
index 9600d67..16b1cb8 100644
--- a/monitor/main.c
+++ b/monitor/main.c
@@ -40,6 +40,10 @@
 #include <bluetooth/hci.h>
 #include <bluetooth/mgmt.h>
 
+#ifndef NELEM
+#define NELEM(x) (sizeof(x) / sizeof((x)[0]))
+#endif
+
 #ifndef HCI_CHANNEL_MONITOR
 #define HCI_CHANNEL_MONITOR  2
 #endif
@@ -686,9 +690,15 @@ static void mgmt_index_removed(uint16_t len, void *buf)
 	hexdump(buf, len);
 }
 
+static const char *settings_str[] = {
+	"powered", "connectable", "fast-connectable", "discoverable",
+	"pairable", "link-security", "ssp", "br/edr", "hs", "le"
+};
+
 static void mgmt_new_settings(uint16_t len, void *buf)
 {
 	uint32_t settings;
+	unsigned int i;
 
         if (len < 4) {
                 printf("* Malformed New Settings control\n");
@@ -699,6 +709,13 @@ static void mgmt_new_settings(uint16_t len, void *buf)
 
 	printf("@ New Settings: 0x%4.4x\n", settings);
 
+	printf("%-12c", ' ');
+	for (i = 0; i < NELEM(settings_str); i++) {
+		if (settings & (1 << i))
+			printf("%s ", settings_str[i]);
+	}
+	printf("\n");
+
 	buf += 4;
 	len -= 4;