Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH v2 1/6] Add parsing for ATT Write Request
@ 2011-03-30 14:01 Andre Dieb Martins
  2011-03-30 14:01 ` [PATCH v2 2/6] Add parsing for ATT Write Command Andre Dieb Martins
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Andre Dieb Martins @ 2011-03-30 14:01 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: andre.dieb

Note we do not need extra parsing for ATT Write Response as it only has one
field (opcode).
---
 parser/att.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/parser/att.c b/parser/att.c
index 7b8b83c..3804206 100644
--- a/parser/att.c
+++ b/parser/att.c
@@ -476,6 +476,18 @@ static void att_read_by_group_resp_dump(int level, struct frame *frm)
 	}
 }
 
+static void att_write_req_dump(int level, struct frame *frm)
+{
+	uint16_t handle = btohs(htons(get_u16(frm)));
+
+	p_indent(level, frm);
+	printf("handle 0x%4.4x value ", handle);
+
+	while (frm->len > 0)
+		printf(" 0x%2.2x", get_u8(frm));
+	printf("\n");
+}
+
 static void att_handle_notify_dump(int level, struct frame *frm)
 {
 	uint16_t handle = btohs(htons(get_u16(frm)));
@@ -549,6 +561,9 @@ void att_dump(int level, struct frame *frm)
 		case ATT_OP_READ_BY_GROUP_RESP:
 			att_read_by_group_resp_dump(level + 1, frm);
 			break;
+		case ATT_OP_WRITE_REQ:
+			att_write_req_dump(level + 1, frm);
+			break;
 		case ATT_OP_HANDLE_NOTIFY:
 			att_handle_notify_dump(level + 1, frm);
 			break;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/6] Add parsing for ATT Write Command
  2011-03-30 14:01 [PATCH v2 1/6] Add parsing for ATT Write Request Andre Dieb Martins
@ 2011-03-30 14:01 ` Andre Dieb Martins
  2011-03-30 14:01 ` [PATCH v2 3/6] Add parsing for ATT Signed Write Andre Dieb Martins
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andre Dieb Martins @ 2011-03-30 14:01 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: andre.dieb

---
 parser/att.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/parser/att.c b/parser/att.c
index 3804206..595c984 100644
--- a/parser/att.c
+++ b/parser/att.c
@@ -562,6 +562,7 @@ void att_dump(int level, struct frame *frm)
 			att_read_by_group_resp_dump(level + 1, frm);
 			break;
 		case ATT_OP_WRITE_REQ:
+		case ATT_OP_WRITE_CMD:
 			att_write_req_dump(level + 1, frm);
 			break;
 		case ATT_OP_HANDLE_NOTIFY:
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/6] Add parsing for ATT Signed Write
  2011-03-30 14:01 [PATCH v2 1/6] Add parsing for ATT Write Request Andre Dieb Martins
  2011-03-30 14:01 ` [PATCH v2 2/6] Add parsing for ATT Write Command Andre Dieb Martins
@ 2011-03-30 14:01 ` Andre Dieb Martins
  2011-03-30 14:01 ` [PATCH v2 4/6] Fix handle formatting for ATT Handle Notify Andre Dieb Martins
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andre Dieb Martins @ 2011-03-30 14:01 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: andre.dieb

---
 parser/att.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/parser/att.c b/parser/att.c
index 595c984..5bff925 100644
--- a/parser/att.c
+++ b/parser/att.c
@@ -488,6 +488,25 @@ static void att_write_req_dump(int level, struct frame *frm)
 	printf("\n");
 }
 
+static void att_signed_write_dump(int level, struct frame *frm)
+{
+	uint16_t handle = btohs(htons(get_u16(frm)));
+	int value_len = frm->len - 12; /* handle:2 already accounted, sig: 12 */
+
+	p_indent(level, frm);
+	printf("handle 0x%4.4x value ", handle);
+
+	while (value_len--)
+		printf(" 0x%2.2x", get_u8(frm));
+	printf("\n");
+
+	p_indent(level, frm);
+	printf("auth signature ");
+	while (frm->len > 0)
+		printf(" 0x%2.2x", get_u8(frm));
+	printf("\n");
+}
+
 static void att_handle_notify_dump(int level, struct frame *frm)
 {
 	uint16_t handle = btohs(htons(get_u16(frm)));
@@ -565,6 +584,9 @@ void att_dump(int level, struct frame *frm)
 		case ATT_OP_WRITE_CMD:
 			att_write_req_dump(level + 1, frm);
 			break;
+		case ATT_OP_SIGNED_WRITE_CMD:
+			att_signed_write_dump(level + 1, frm);
+			break;
 		case ATT_OP_HANDLE_NOTIFY:
 			att_handle_notify_dump(level + 1, frm);
 			break;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 4/6] Fix handle formatting for ATT Handle Notify
  2011-03-30 14:01 [PATCH v2 1/6] Add parsing for ATT Write Request Andre Dieb Martins
  2011-03-30 14:01 ` [PATCH v2 2/6] Add parsing for ATT Write Command Andre Dieb Martins
  2011-03-30 14:01 ` [PATCH v2 3/6] Add parsing for ATT Signed Write Andre Dieb Martins
@ 2011-03-30 14:01 ` Andre Dieb Martins
  2011-03-30 14:01 ` [PATCH v2 5/6] Add parsing for ATT Prepare Write Andre Dieb Martins
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andre Dieb Martins @ 2011-03-30 14:01 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: andre.dieb

---
 parser/att.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/parser/att.c b/parser/att.c
index 5bff925..a1cd9af 100644
--- a/parser/att.c
+++ b/parser/att.c
@@ -512,7 +512,7 @@ static void att_handle_notify_dump(int level, struct frame *frm)
 	uint16_t handle = btohs(htons(get_u16(frm)));
 
 	p_indent(level, frm);
-	printf("handle 0x%2.2x\n", handle);
+	printf("handle 0x%4.4x\n", handle);
 
 	p_indent(level, frm);
 	printf("value ");
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 5/6] Add parsing for ATT Prepare Write
  2011-03-30 14:01 [PATCH v2 1/6] Add parsing for ATT Write Request Andre Dieb Martins
                   ` (2 preceding siblings ...)
  2011-03-30 14:01 ` [PATCH v2 4/6] Fix handle formatting for ATT Handle Notify Andre Dieb Martins
@ 2011-03-30 14:01 ` Andre Dieb Martins
  2011-03-30 14:01 ` [PATCH v2 6/6] Add parsing for ATT Execute Write command Andre Dieb Martins
  2011-03-30 16:47 ` [PATCH v2 1/6] Add parsing for ATT Write Request Johan Hedberg
  5 siblings, 0 replies; 7+ messages in thread
From: Andre Dieb Martins @ 2011-03-30 14:01 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: andre.dieb

---
 parser/att.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/parser/att.c b/parser/att.c
index a1cd9af..7046357 100644
--- a/parser/att.c
+++ b/parser/att.c
@@ -507,6 +507,22 @@ static void att_signed_write_dump(int level, struct frame *frm)
 	printf("\n");
 }
 
+static void att_prep_write_dump(int level, struct frame *frm)
+{
+	uint16_t handle = btohs(htons(get_u16(frm)));
+	uint16_t val_offset = btohs(htons(get_u16(frm)));
+
+	p_indent(level, frm);
+	printf("attr handle 0x%4.4x, value offset 0x%4.4x\n", handle,
+								val_offset);
+
+	p_indent(level, frm);
+	printf("part attr value ");
+	while (frm->len > 0)
+		printf(" 0x%2.2x", get_u8(frm));
+	printf("\n");
+}
+
 static void att_handle_notify_dump(int level, struct frame *frm)
 {
 	uint16_t handle = btohs(htons(get_u16(frm)));
@@ -587,6 +603,10 @@ void att_dump(int level, struct frame *frm)
 		case ATT_OP_SIGNED_WRITE_CMD:
 			att_signed_write_dump(level + 1, frm);
 			break;
+		case ATT_OP_PREP_WRITE_REQ:
+		case ATT_OP_PREP_WRITE_RESP:
+			att_prep_write_dump(level + 1, frm);
+			break;
 		case ATT_OP_HANDLE_NOTIFY:
 			att_handle_notify_dump(level + 1, frm);
 			break;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 6/6] Add parsing for ATT Execute Write command
  2011-03-30 14:01 [PATCH v2 1/6] Add parsing for ATT Write Request Andre Dieb Martins
                   ` (3 preceding siblings ...)
  2011-03-30 14:01 ` [PATCH v2 5/6] Add parsing for ATT Prepare Write Andre Dieb Martins
@ 2011-03-30 14:01 ` Andre Dieb Martins
  2011-03-30 16:47 ` [PATCH v2 1/6] Add parsing for ATT Write Request Johan Hedberg
  5 siblings, 0 replies; 7+ messages in thread
From: Andre Dieb Martins @ 2011-03-30 14:01 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: andre.dieb

BT's Core V4.0 document is buggy regarding Execute Write Response, so we'll
leave it out until a proper description is given.
---
 parser/att.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/parser/att.c b/parser/att.c
index 7046357..a6f42df 100644
--- a/parser/att.c
+++ b/parser/att.c
@@ -523,6 +523,19 @@ static void att_prep_write_dump(int level, struct frame *frm)
 	printf("\n");
 }
 
+static void att_exec_write_req_dump(int level, struct frame *frm)
+{
+	uint8_t flags = get_u8(frm);
+
+	p_indent(level, frm);
+	if (flags == 0x00)
+		printf("cancel all prepared writes ");
+	else
+		printf("immediatelly write all pending prepared values ");
+
+	printf("(0x%2.2x)\n", flags);
+}
+
 static void att_handle_notify_dump(int level, struct frame *frm)
 {
 	uint16_t handle = btohs(htons(get_u16(frm)));
@@ -607,6 +620,9 @@ void att_dump(int level, struct frame *frm)
 		case ATT_OP_PREP_WRITE_RESP:
 			att_prep_write_dump(level + 1, frm);
 			break;
+		case ATT_OP_EXEC_WRITE_REQ:
+			att_exec_write_req_dump(level + 1, frm);
+			break;
 		case ATT_OP_HANDLE_NOTIFY:
 			att_handle_notify_dump(level + 1, frm);
 			break;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/6] Add parsing for ATT Write Request
  2011-03-30 14:01 [PATCH v2 1/6] Add parsing for ATT Write Request Andre Dieb Martins
                   ` (4 preceding siblings ...)
  2011-03-30 14:01 ` [PATCH v2 6/6] Add parsing for ATT Execute Write command Andre Dieb Martins
@ 2011-03-30 16:47 ` Johan Hedberg
  5 siblings, 0 replies; 7+ messages in thread
From: Johan Hedberg @ 2011-03-30 16:47 UTC (permalink / raw)
  To: Andre Dieb Martins; +Cc: linux-bluetooth

Hi André,

On Wed, Mar 30, 2011, Andre Dieb Martins wrote:
> Note we do not need extra parsing for ATT Write Response as it only has one
> field (opcode).
> ---
>  parser/att.c |   15 +++++++++++++++
>  1 files changed, 15 insertions(+), 0 deletions(-)

All patches in this set have been pushed upstream. Thanks.

Johan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-03-30 16:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-30 14:01 [PATCH v2 1/6] Add parsing for ATT Write Request Andre Dieb Martins
2011-03-30 14:01 ` [PATCH v2 2/6] Add parsing for ATT Write Command Andre Dieb Martins
2011-03-30 14:01 ` [PATCH v2 3/6] Add parsing for ATT Signed Write Andre Dieb Martins
2011-03-30 14:01 ` [PATCH v2 4/6] Fix handle formatting for ATT Handle Notify Andre Dieb Martins
2011-03-30 14:01 ` [PATCH v2 5/6] Add parsing for ATT Prepare Write Andre Dieb Martins
2011-03-30 14:01 ` [PATCH v2 6/6] Add parsing for ATT Execute Write command Andre Dieb Martins
2011-03-30 16:47 ` [PATCH v2 1/6] Add parsing for ATT Write Request Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox