From ba739af87d2ebb85355cd3768fbd6ff540d2940f Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 22 Feb 2012 16:25:13 +0100 Subject: [PATCH] monitor: Decode management new settings values --- monitor/main.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/monitor/main.c b/monitor/main.c index 9600d67f0..16b1cb8d5 100644 --- a/monitor/main.c +++ b/monitor/main.c @@ -40,6 +40,10 @@ #include #include +#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; -- 2.47.3