From: Andre Dieb Martins <andre.dieb@signove.com>
To: linux-bluetooth@vger.kernel.org
Cc: Andre Dieb Martins <andre.dieb@signove.com>
Subject: [PATCH -v3 6/6] Add ATT read by type req/resp dump
Date: Wed, 9 Feb 2011 14:28:55 -0300 [thread overview]
Message-ID: <1297272535-14890-6-git-send-email-andre.dieb@signove.com> (raw)
In-Reply-To: <1297272535-14890-1-git-send-email-andre.dieb@signove.com>
---
parser/att.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/parser/att.c b/parser/att.c
index 887cdac..a0fb135 100644
--- a/parser/att.c
+++ b/parser/att.c
@@ -330,6 +330,54 @@ static void att_find_info_resp_dump(int level, struct frame *frm)
}
}
+static void att_read_by_type_req_dump(int level, struct frame *frm)
+{
+ uint16_t start = btohs(htons(get_u16(frm)));
+ uint16_t end = btohs(htons(get_u16(frm)));
+ int i;
+
+ p_indent(level, frm);
+ printf("start 0x%2.2x, end 0x%2.2x\n", start, end);
+
+ p_indent(level, frm);
+ if (frm->len == 2) {
+ printf("type-uuid 0x%2.2x\n", btohs(htons(get_u16(frm))));
+ } else if (frm->len == 16) {
+ printf("type-uuid ");
+ for (i = 0; i < 16; i++) {
+ printf("%02x", get_u8(frm));
+ if (i == 3 || i == 5 || i == 7 || i == 9)
+ printf("-");
+ }
+ printf("\n");
+ } else {
+ printf("malformed uuid (expected 2 or 16 octets)\n");
+ p_indent(level, frm);
+ raw_dump(level, frm);
+ }
+}
+
+static void att_read_by_type_resp_dump(int level, struct frame *frm)
+{
+ uint8_t length = get_u8(frm);
+
+ p_indent(level, frm);
+ printf("length: %d\n", length);
+
+ while (frm->len > 0) {
+ uint16_t handle = btohs(htons(get_u16(frm)));
+ int val_len = length - 2;
+ int i;
+
+ p_indent(level + 1, frm);
+ printf("handle 0x%2.2x, value ", handle);
+ for (i = 0; i < val_len; i++) {
+ printf("0x%.2x ", get_u8(frm));
+ }
+ printf("\n");
+ }
+}
+
static void att_read_req_dump(int level, struct frame *frm)
{
uint16_t handle = btohs(htons(get_u16(frm)));
@@ -378,6 +426,12 @@ void att_dump(int level, struct frame *frm)
case ATT_OP_FIND_INFO_RESP:
att_find_info_resp_dump(level + 1, frm);
break;
+ case ATT_OP_READ_BY_TYPE_REQ:
+ att_read_by_type_req_dump(level + 1, frm);
+ break;
+ case ATT_OP_READ_BY_TYPE_RESP:
+ att_read_by_type_resp_dump(level + 1, frm);
+ break;
case ATT_OP_READ_REQ:
att_read_req_dump(level + 1, frm);
break;
--
1.7.1
next prev parent reply other threads:[~2011-02-09 17:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-09 17:28 [PATCH -v3 1/6] Partial dump of ATT PDUs Andre Dieb Martins
2011-02-09 17:28 ` [PATCH -v3 2/6] Add ATT MTU req/resp and notify value Andre Dieb Martins
2011-02-09 17:28 ` [PATCH -v3 3/6] Add ATT error pdu dump Andre Dieb Martins
2011-02-09 17:28 ` [PATCH -v3 4/6] Add ATT find info req/resp dump Andre Dieb Martins
2011-02-09 17:28 ` [PATCH -v3 5/6] Add ATT dump for read req/resp Andre Dieb Martins
2011-02-09 17:28 ` Andre Dieb Martins [this message]
2011-02-09 22:03 ` [PATCH -v3 1/6] Partial dump of ATT PDUs Johan Hedberg
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=1297272535-14890-6-git-send-email-andre.dieb@signove.com \
--to=andre.dieb@signove.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