Diff between 90799f6da988723a7d100610f51f2b7f30f40d4f and 3112a1be16d59f528d4dc396447a29f0759b617b

Changed Files

File Additions Deletions Status
monitor/bt.h +12 -0 modified
monitor/lmp.c +23 -2 modified

Full Patch

diff --git a/monitor/bt.h b/monitor/bt.h
index 5040411..5024e57 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -101,6 +101,18 @@ struct bt_ll_reject_ind {
 
 #define LMP_ESC4(x) ((127 << 8) | (x))
 
+#define BT_LMP_NAME_REQ			1
+struct bt_lmp_name_req {
+	uint8_t  offset;
+} __attribute__ ((packed));
+
+#define BT_LMP_NAME_RSP			2
+struct bt_lmp_name_rsp {
+	uint8_t  offset;
+	uint8_t  length;
+	uint8_t  fragment[14];
+} __attribute__ ((packed));
+
 #define BT_LMP_ACCEPTED			3
 struct bt_lmp_accepted {
 	uint8_t  opcode;
diff --git a/monitor/lmp.c b/monitor/lmp.c
index d36861a..f85b4d8 100644
--- a/monitor/lmp.c
+++ b/monitor/lmp.c
@@ -27,6 +27,7 @@
 #endif
 
 #include <stdio.h>
+#include <string.h>
 
 #include "src/shared/util.h"
 #include "display.h"
@@ -54,6 +55,26 @@ static void print_opcode(uint16_t opcode)
 		print_field("Operation: %s (%u)", str, opcode);
 }
 
+static void name_req(const void *data, uint8_t size)
+{
+	const struct bt_lmp_name_req *pdu = data;
+
+	print_field("Offset: %u", pdu->offset);
+}
+
+static void name_rsp(const void *data, uint8_t size)
+{
+	const struct bt_lmp_name_rsp *pdu = data;
+	char str[15];
+
+	memcpy(str, pdu->fragment, 14);
+	str[14] = '\0';
+
+	print_field("Offset: %u", pdu->offset);
+	print_field("Length: %u", pdu->length);
+	print_field("Fragment: %s", str);
+}
+
 static void accepted(const void *data, uint8_t size)
 {
 	const struct bt_lmp_accepted *pdu = data;
@@ -625,8 +646,8 @@ struct lmp_data {
 };
 
 static const struct lmp_data lmp_table[] = {
-	{  1, "LMP_name_req" },
-	{  2, "LMP_name_res" },
+	{  1, "LMP_name_req", name_req, 1, true },
+	{  2, "LMP_name_res", name_rsp, 16, true },
 	{  3, "LMP_accepted", accepted, 1, true },
 	{  4, "LMP_not_accepted", not_accepted, 2, true },
 	{  5, "LMP_clkoffset_req", clkoffset_req, 0, true },