Diff between afc8c8f56fa2376137cd093bb5a8c63dc408d94f and c53cb7be2d61e7bdf26c20f61f94d572068d5c6b

Changed Files

File Additions Deletions Status
monitor/att.c +18 -7 modified

Full Patch

diff --git a/monitor/att.c b/monitor/att.c
index de70a9d..34babac 100644
--- a/monitor/att.c
+++ b/monitor/att.c
@@ -1290,17 +1290,12 @@ static struct gatt_db_attribute *get_attribute(const struct l2cap_frame *frame,
 	return gatt_db_get_attribute(db, handle);
 }
 
-static void print_handle(const struct l2cap_frame *frame, uint16_t handle,
-								bool rsp)
+static void print_attribute(struct gatt_db_attribute *attr)
 {
-	struct gatt_db_attribute *attr;
+	uint16_t handle = gatt_db_attribute_get_handle(attr);
 	const bt_uuid_t *uuid;
 	char label[21];
 
-	attr = get_attribute(frame, handle, rsp);
-	if (!attr)
-		goto done;
-
 	uuid = gatt_db_attribute_get_type(attr);
 	if (!uuid)
 		goto done;
@@ -1323,6 +1318,20 @@ done:
 	print_field("Handle: 0x%4.4x", handle);
 }
 
+static void print_handle(const struct l2cap_frame *frame, uint16_t handle,
+								bool rsp)
+{
+	struct gatt_db_attribute *attr;
+
+	attr = get_attribute(frame, handle, rsp);
+	if (!attr) {
+		print_field("Handle: 0x%4.4x", handle);
+		return;
+	}
+
+	print_attribute(attr);
+}
+
 static void att_read_req(const struct l2cap_frame *frame)
 {
 	const struct bt_l2cap_att_read_req *pdu = frame->data;
@@ -1393,6 +1402,8 @@ static void att_read_rsp(const struct l2cap_frame *frame)
 	if (!read)
 		return;
 
+	print_attribute(read->attr);
+
 	read->func(frame);
 
 	free(read);