From: Luiz Augusto von Dentz Date: Fri, 17 Jun 2022 00:30:31 +0000 (-0700) Subject: monitor/att: Print attribute information on ATT_REQ_RSP X-Git-Tag: accepted/tizen/unified/20230608.164325~192 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=091d8a020dd32e1418b3da4675d1d624ffb04bad;p=platform%2Fupstream%2Fbluez.git monitor/att: Print attribute information on ATT_REQ_RSP This prints the attribute information on ATT_REQ_RSP to make it easier to identify to which handle the response is for: > ACL Data RX: Handle 42 flags 0x02 dlen 9 Channel: 65 len 5 sdu 3 [PSM 39 mode Enhanced Credit (0x81)] {chan 1} ATT: Read Response (0x0b) len 2 Value: 0300 Handle: 0x0030 Type: Source ASE (0x2bc5) ASE ID: 3 State: Idle (0x00) Signed-off-by: Manika Shrivastava Signed-off-by: Ayush Garg --- diff --git a/monitor/att.c b/monitor/att.c index a678282..0707345 100644 --- a/monitor/att.c +++ b/monitor/att.c @@ -1289,17 +1289,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; @@ -1322,6 +1317,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; @@ -1392,6 +1401,8 @@ static void att_read_rsp(const struct l2cap_frame *frame) if (!read) return; + print_attribute(read->attr); + read->func(frame); free(read);