From: "Jérôme Poulin" <jeromepoulin@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: "Jérôme Poulin" <jeromepoulin@gmail.com>
Subject: [PATCH] Dump advertisement data for LE
Date: Mon, 24 Feb 2014 02:23:21 -0500 [thread overview]
Message-ID: <1393226601-18336-1-git-send-email-jeromepoulin@gmail.com> (raw)
This patch allows hcidump to dump data inside currently unknown fields, LE
devices like the RFduino will include this kind of data in every broadcast.
---
tools/parser/hci.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tools/parser/hci.c b/tools/parser/hci.c
index 17b776d..bf117ce 100644
--- a/tools/parser/hci.c
+++ b/tools/parser/hci.c
@@ -766,6 +766,7 @@ static inline void ext_inquiry_data_dump(int level, struct frame *frm,
{
uint8_t len = data[0];
uint8_t type;
+ char *hexdump;
char *str;
int i;
@@ -821,6 +822,22 @@ static inline void ext_inquiry_data_dump(int level, struct frame *frm,
p_indent(level, frm);
printf("Unknown type 0x%02x with %d bytes data\n",
type, len);
+ str = malloc(len + 1);
+ hexdump = malloc(len*3 + 1);
+ if (str && hexdump) {
+ memcpy(str, data, len);
+ str[len + 1] = 0;
+ for (i = 0; i < len; i++) {
+ sprintf(hexdump+i*3, "%02x ",
+ (unsigned char) str[i]);
+ if (!isprint(str[i]))
+ str[i] = '.';
+ }
+ p_indent(level + 1, frm);
+ printf("data: %s| %s\n", hexdump, str);
+ free(hexdump);
+ free(str);
+ }
break;
}
}
--
1.8.5.3
reply other threads:[~2014-02-24 7:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1393226601-18336-1-git-send-email-jeromepoulin@gmail.com \
--to=jeromepoulin@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