From 1ef26f22f8ab6f08053ae8f3f6c35c33bbdfc121 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 2 Jun 2015 22:38:11 +0700 Subject: [PATCH] monitor: Add full key type decoding for New Link Key events --- monitor/control.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/monitor/control.c b/monitor/control.c index e61a79d64..10e8b7f76 100644 --- a/monitor/control.c +++ b/monitor/control.c @@ -261,16 +261,34 @@ static void mgmt_local_name_changed(uint16_t len, const void *buf) static void mgmt_new_link_key(uint16_t len, const void *buf) { const struct mgmt_ev_new_link_key *ev = buf; + const char *type; char str[18]; + static const char *types[] = { + "Combination key", + "Local Unit key", + "Remote Unit key", + "Debug Combination key", + "Unauthenticated Combination key from P-192", + "Authenticated Combination key from P-192", + "Changed Combination key", + "Unauthenticated Combination key from P-256", + "Authenticated Combination key from P-256", + }; if (len < sizeof(*ev)) { printf("* Malformed New Link Key control\n"); return; } + if (ev->key.type < NELEM(types)) + type = types[ev->key.type]; + else + type = "Reserved"; + ba2str(&ev->key.addr.bdaddr, str); - printf("@ New Link Key: %s (%d)\n", str, ev->key.addr.type); + printf("@ New Link Key: %s (%d) %s (%u)\n", str, + ev->key.addr.type, type, ev->key.type); buf += sizeof(*ev); len -= sizeof(*ev); -- 2.47.3