From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 1/4] monitor/att: Print attribute information on ATT_REQ_RSP
Date: Thu, 16 Jun 2022 17:49:54 -0700 [thread overview]
Message-ID: <20220617004957.1148939-1-luiz.dentz@gmail.com> (raw)
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
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)
---
monitor/att.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/monitor/att.c b/monitor/att.c
index de70a9dc4..34babac6b 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);
--
2.35.3
next reply other threads:[~2022-06-17 0:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-17 0:49 Luiz Augusto von Dentz [this message]
2022-06-17 0:49 ` [PATCH BlueZ 2/4] monitor/att: Add decoding support for PAC Sink/Source Location Luiz Augusto von Dentz
2022-06-17 0:49 ` [PATCH BlueZ 3/4] monitor/att: Add decoding support for PAC Audio Context Luiz Augusto von Dentz
2022-06-17 0:49 ` [PATCH BlueZ 4/4] monitor/att: Add LTV deconding support for PAC/ASE Luiz Augusto von Dentz
2022-06-17 5:28 ` [BlueZ,1/4] monitor/att: Print attribute information on ATT_REQ_RSP bluez.test.bot
2022-06-17 21:10 ` [PATCH BlueZ 1/4] " patchwork-bot+bluetooth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220617004957.1148939-1-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).