Diff between cdc215e1b48599c1a96acae195dd5980453c9304 and 252222a414221150f0cddace93e2d852555fdc3a

Changed Files

File Additions Deletions Status
monitor/control.c +27 -0 modified

Full Patch

diff --git a/monitor/control.c b/monitor/control.c
index 6f35c2b..d4085ef 100644
--- a/monitor/control.c
+++ b/monitor/control.c
@@ -469,6 +469,30 @@ static void mgmt_device_unpaired(uint16_t len, const void *buf)
 	packet_hexdump(buf, len);
 }
 
+static void mgmt_passkey_notify(uint16_t len, const void *buf)
+{
+	const struct mgmt_ev_passkey_notify *ev = buf;
+	uint32_t passkey;
+	char str[18];
+
+	if (len < sizeof(*ev)) {
+		printf("* Malformed Passkey Notify control\n");
+		return;
+	}
+
+	ba2str(&ev->addr.bdaddr, str);
+
+	passkey = btohl(ev->passkey);
+
+	printf("@ Passkey Notify: %s (%d) passkey %06u entered %u\n",
+				str, ev->addr.type, passkey, ev->entered);
+
+	buf += sizeof(*ev);
+	len -= sizeof(*ev);
+
+	packet_hexdump(buf, len);
+}
+
 void control_message(uint16_t opcode, const void *data, uint16_t size)
 {
 	switch (opcode) {
@@ -532,6 +556,9 @@ void control_message(uint16_t opcode, const void *data, uint16_t size)
 	case MGMT_EV_DEVICE_UNPAIRED:
 		mgmt_device_unpaired(size, data);
 		break;
+	case MGMT_EV_PASSKEY_NOTIFY:
+		mgmt_passkey_notify(size, data);
+		break;
 	default:
 		printf("* Unknown control (code %d len %d)\n", opcode, size);
 		packet_hexdump(data, size);