2009-08-09 08:41:05

by Gustavo F. Padovan

[permalink] [raw]
Subject: [PATCH 0/4] patch set for l2cap parser on hcidump

Hi,

These patches add support to dump data from the new L2CAP features such as Enhanced Retransmission and Streaming Modes and FCS Option(a crc16 check).
It also adds a .gitignore file for the whole hcidump.


.gitignore | 28 ++++++++++++++++++++++++++++
parser/l2cap.c | 35 ++++++++++++++++++++++++++++++++++-
2 files changed, 62 insertions(+), 1 deletions(-)


2009-08-09 08:41:09

by Gustavo F. Padovan

[permalink] [raw]
Subject: [PATCH 4/4] Dump the FCS Option while configuring devices.

Add support to show the FCS Option value in a configuration request into
the L2CAP layer.
---
parser/l2cap.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/parser/l2cap.c b/parser/l2cap.c
index 3bcb531..436f039 100644
--- a/parser/l2cap.c
+++ b/parser/l2cap.c
@@ -315,6 +315,18 @@ static char *mode2str(uint8_t mode)
}
}

+static char *fcs2str(uint8_t fcs)
+{
+ switch (fcs) {
+ case 0x00:
+ return "No FCS";
+ case 0x01:
+ return "CRC16 Check";
+ default:
+ return "Reserved";
+ }
+}
+
static char *sar2str(uint8_t sar)
{
switch (sar) {
@@ -446,6 +458,16 @@ static void conf_rfc(void *ptr, int len, int in, uint16_t cid)
printf(")");
}

+static void conf_fcs(void *ptr, int len)
+{
+ uint8_t fcs;
+
+ fcs = *((uint8_t *) ptr);
+ printf("FCS Option");
+ if (len > 0)
+ printf(" 0x%2.2x (%s)", fcs, fcs2str(fcs));
+}
+
static void conf_opt(int level, void *ptr, int len, int in, uint16_t cid)
{
p_indent(level, 0);
@@ -482,6 +504,10 @@ static void conf_opt(int level, void *ptr, int len, int in, uint16_t cid)
conf_rfc(h->val, h->len, in, cid);
break;

+ case L2CAP_CONF_FCS:
+ conf_fcs(h->val, h->len);
+ break;
+
default:
printf("Unknown (type %2.2x, len %d)", h->type & 0x7f, h->len);
break;
@@ -514,6 +540,9 @@ static void conf_list(int level, uint8_t *list, int len)
case L2CAP_CONF_RFC:
printf("RFC ");
break;
+ case L2CAP_CONF_FCS:
+ printf("FCS ");
+ break;
default:
printf("%2.2x ", list[i] & 0x7f);
break;
--
1.6.3.3

2009-08-09 08:41:08

by Gustavo F. Padovan

[permalink] [raw]
Subject: [PATCH 3/4] Add support to show RFC option for ERTM and Streaming Mode

Show TxWindow, MaxTransmit, Retransmission Timeout, Monitor Timeout and
MPS for ERTM and Streaming mode.
---
parser/l2cap.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/parser/l2cap.c b/parser/l2cap.c
index 4ab4123..3bcb531 100644
--- a/parser/l2cap.c
+++ b/parser/l2cap.c
@@ -432,7 +432,7 @@ static void conf_rfc(void *ptr, int len, int in, uint16_t cid)
set_mode(in, cid, mode);

printf("RFC 0x%02x (%s", mode, mode2str(mode));
- if (mode == 0x01 || mode == 0x02) {
+ if (mode >= 0x01 && mode <= 0x04) {
uint8_t txwin, maxtrans;
uint16_t rto, mto, mps;
txwin = *((uint8_t *) (ptr + 1));
--
1.6.3.3


2009-08-09 08:41:07

by Gustavo F. Padovan

[permalink] [raw]
Subject: [PATCH 2/4] Add .gitignore for bluez-hcidump

this file avoids dirty things on git status
---
.gitignore | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
create mode 100644 .gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..76bcb61
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,28 @@
+*.o
+*.a
+*.lo
+*.la
+*.so
+.deps
+.libs
+Makefile
+Makefile.in
+aclocal.m4
+config.guess
+config.h
+config.h.in
+config.log
+config.status
+config.sub
+configure
+depcomp
+install-sh
+libtool
+ltmain.sh
+missing
+stamp-h1
+autom4te.cache
+
+src/bpasniff
+src/csrsniff
+src/hcidump
--
1.6.3.3


2009-08-09 08:41:06

by Gustavo F. Padovan

[permalink] [raw]
Subject: [PATCH 1/4] Add case for Enhanced Retransmission and Streaming modes

Just add return values on mode2str for the new modes on L2CAP
---
parser/l2cap.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/parser/l2cap.c b/parser/l2cap.c
index a906f42..4ab4123 100644
--- a/parser/l2cap.c
+++ b/parser/l2cap.c
@@ -306,6 +306,10 @@ static char *mode2str(uint8_t mode)
return "Retransmission";
case 0x02:
return "Flow control";
+ case 0x03:
+ return "Enhanced Retransmission";
+ case 0x04:
+ return "Streaming";
default:
return "Reserved";
}
--
1.6.3.3