linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] Add support for RFCOMM in btmon
@ 2014-10-31 14:03 Gowtham Anandha Babu
  2014-10-31 14:03 ` [PATCH 1/6] monitor/rfcomm: Add RFCOMM support to btmon Gowtham Anandha Babu
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Gowtham Anandha Babu @ 2014-10-31 14:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: d.kasatkin, bharat.panda, cpgs, Gowtham Anandha Babu

Adds an initial implementation for RFCOMM in Bluetooth monitor.

Implementation for Decoding MSC, RPN, RLS, PN, NSC frames 
will  be covered in the next patch-set.

Bharat Panda (2):
  monitor/rfcomm: Add handlers for mcc frame type
  monitor/rfcomm: Add mcc type handlers code

Gowtham Anandha Babu (4):
  monitor/rfcomm: Add RFCOMM support to btmon
  monitor/rfcomm: Add support for RFCOMM commands
  monitor/rfcomm: Add support for UIH frame decoding
  monitor/rfcomm: Add support for mcc frame decoding

 Makefile.tools   |   1 +
 monitor/l2cap.c  |   4 +
 monitor/l2cap.h  |   1 +
 monitor/rfcomm.c | 333 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 339 insertions(+)
 create mode 100644 monitor/rfcomm.c

-- 
1.9.1


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

* [PATCH 1/6] monitor/rfcomm: Add RFCOMM support to btmon
  2014-10-31 14:03 [PATCH 0/6] Add support for RFCOMM in btmon Gowtham Anandha Babu
@ 2014-10-31 14:03 ` Gowtham Anandha Babu
  2014-10-31 14:03 ` [PATCH 2/6] monitor/rfcomm: Add support for RFCOMM commands Gowtham Anandha Babu
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Gowtham Anandha Babu @ 2014-10-31 14:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: d.kasatkin, bharat.panda, cpgs, Gowtham Anandha Babu

Changes made to add initial code to support RFCOMM frame in btmon.
---
 Makefile.tools   |  1 +
 monitor/l2cap.c  |  4 ++++
 monitor/l2cap.h  |  1 +
 monitor/rfcomm.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 67 insertions(+)
 create mode 100644 monitor/rfcomm.c

diff --git a/Makefile.tools b/Makefile.tools
index 42cccc6..75a6faa 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -26,6 +26,7 @@ monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \
 				monitor/l2cap.h monitor/l2cap.c \
 				monitor/sdp.h monitor/sdp.c \
 				monitor/avctp.h monitor/avctp.c \
+				monitor/rfcomm.h monitor/rfcomm.c \
 				monitor/uuid.h monitor/uuid.c \
 				monitor/hwdb.h monitor/hwdb.c \
 				monitor/keys.h monitor/keys.c \
diff --git a/monitor/l2cap.c b/monitor/l2cap.c
index c004d6b..ebdd20f 100644
--- a/monitor/l2cap.c
+++ b/monitor/l2cap.c
@@ -42,6 +42,7 @@
 #include "keys.h"
 #include "sdp.h"
 #include "avctp.h"
+#include "rfcomm.h"
 
 #define MAX_CHAN 64
 
@@ -2643,6 +2644,9 @@ static void l2cap_frame(uint16_t index, bool in, uint16_t handle,
 		case 0x0001:
 			sdp_packet(&frame);
 			break;
+		case 0x0003:
+			rfcomm_packet(&frame);
+			break;
 		case 0x001f:
 			att_packet(index, in, handle, cid, data, size);
 			break;
diff --git a/monitor/l2cap.h b/monitor/l2cap.h
index 5faaea6..1f70b68 100644
--- a/monitor/l2cap.h
+++ b/monitor/l2cap.h
@@ -153,3 +153,4 @@ static inline bool l2cap_frame_get_le64(struct l2cap_frame *frame,
 
 void l2cap_packet(uint16_t index, bool in, uint16_t handle, uint8_t flags,
 					const void *data, uint16_t size);
+void rfcomm_packet(const struct l2cap_frame *frame);
diff --git a/monitor/rfcomm.c b/monitor/rfcomm.c
new file mode 100644
index 0000000..7d38a28
--- /dev/null
+++ b/monitor/rfcomm.c
@@ -0,0 +1,61 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2011-2014  Intel Corporation
+ *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <inttypes.h>
+
+#include <bluetooth/bluetooth.h>
+
+#include "src/shared/util.h"
+#include "bt.h"
+#include "packet.h"
+#include "display.h"
+#include "l2cap.h"
+#include "uuid.h"
+#include "keys.h"
+#include "sdp.h"
+#include "rfcomm.h"
+
+const char *opcode_color;
+
+void rfcomm_packet(const struct l2cap_frame *frame)
+{
+	if (frame->in)
+		opcode_color = COLOR_MAGENTA;
+	else
+		opcode_color = COLOR_BLUE;
+
+	print_indent(7, opcode_color, "RFCOMM: ", "", 
+							COLOR_OFF, "");
+
+	packet_hexdump(frame->data, frame->size);
+	return;
+}
-- 
1.9.1


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

* [PATCH 2/6] monitor/rfcomm: Add support for RFCOMM commands
  2014-10-31 14:03 [PATCH 0/6] Add support for RFCOMM in btmon Gowtham Anandha Babu
  2014-10-31 14:03 ` [PATCH 1/6] monitor/rfcomm: Add RFCOMM support to btmon Gowtham Anandha Babu
@ 2014-10-31 14:03 ` Gowtham Anandha Babu
  2014-10-31 14:03 ` [PATCH 3/6] monitor/rfcomm: Add support for UIH frame decoding Gowtham Anandha Babu
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Gowtham Anandha Babu @ 2014-10-31 14:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: d.kasatkin, bharat.panda, cpgs, Gowtham Anandha Babu

Changes made to decode RFCOMM specific commands in btmon.
---
 monitor/rfcomm.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 71 insertions(+), 2 deletions(-)

diff --git a/monitor/rfcomm.c b/monitor/rfcomm.c
index 7d38a28..395a7b8 100644
--- a/monitor/rfcomm.c
+++ b/monitor/rfcomm.c
@@ -44,18 +44,87 @@
 #include "sdp.h"
 #include "rfcomm.h"
 
+#define GET_LEN8(length) ((length & 0xfe) >> 1)
+#define GET_LEN16(length) ((length & 0xfffe) >> 1)
+
+struct rfcomm_lhdr {
+	uint8_t address;
+	uint8_t control;
+	uint16_t length;
+} __attribute__((packed));
+
 const char *opcode_color;
 
+static void print_rfcomm_hdr(const struct l2cap_frame *frame,
+						struct rfcomm_lhdr hdr)
+{
+}
+
+static bool uih_frame(const struct l2cap_frame *frame, struct rfcomm_lhdr hdr)
+{
+	return true;
+}
+
 void rfcomm_packet(const struct l2cap_frame *frame)
 {
+	uint8_t ctr_type, length, ex_length;
+	const char *opcode_str;
+	struct rfcomm_lhdr hdr;
+	struct l2cap_frame rfcomm_frame;
+
+	l2cap_frame_pull(&rfcomm_frame, frame, 0);
+
+	if (!l2cap_frame_get_u8(&rfcomm_frame, &hdr.address) ||
+			!l2cap_frame_get_u8(&rfcomm_frame, &hdr.control) ||
+			!l2cap_frame_get_u8(&rfcomm_frame, &length))
+		goto fail;
+
+	if (RFCOMM_TEST_EA(length))
+		hdr.length = (uint16_t) GET_LEN8(length);
+	else {
+		if (!l2cap_frame_get_u8(&rfcomm_frame, &ex_length))
+			goto fail;
+		hdr.length = ((uint16_t)length << 8) | ex_length;
+		hdr.length = GET_LEN16(hdr.length);
+	}
+
 	if (frame->in)
 		opcode_color = COLOR_MAGENTA;
 	else
 		opcode_color = COLOR_BLUE;
 
-	print_indent(7, opcode_color, "RFCOMM: ", "", 
-							COLOR_OFF, "");
+	ctr_type = RFCOMM_GET_TYPE(hdr.control);
+
+	if (ctr_type == RFCOMM_UIH) {
+		if (uih_frame(&rfcomm_frame, hdr))
+			return;
+		goto fail;
+	} else {
+		switch (ctr_type) {
+		case RFCOMM_SABM:
+			opcode_str = "SABM";
+			break;
+		case RFCOMM_UA:
+			opcode_str = "UA";
+			break;
+		case RFCOMM_DM:
+			opcode_str = "DM";
+			break;
+		case RFCOMM_DISC:
+			opcode_str = "DISC";
+			break;
+		default:
+			opcode_str = "ERR";
+		}
+
+		print_indent(7, opcode_color, "RFCOMM(s): ", opcode_str,
+								COLOR_OFF, "");
+		print_rfcomm_hdr(&rfcomm_frame, hdr);
+		return;
+	}
 
+fail:
+	print_text(COLOR_ERROR, "Frame too short");
 	packet_hexdump(frame->data, frame->size);
 	return;
 }
-- 
1.9.1


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

* [PATCH 3/6] monitor/rfcomm: Add support for UIH frame decoding
  2014-10-31 14:03 [PATCH 0/6] Add support for RFCOMM in btmon Gowtham Anandha Babu
  2014-10-31 14:03 ` [PATCH 1/6] monitor/rfcomm: Add RFCOMM support to btmon Gowtham Anandha Babu
  2014-10-31 14:03 ` [PATCH 2/6] monitor/rfcomm: Add support for RFCOMM commands Gowtham Anandha Babu
@ 2014-10-31 14:03 ` Gowtham Anandha Babu
  2014-10-31 14:03 ` [PATCH 4/6] monitor/rfcomm: Add support for mcc " Gowtham Anandha Babu
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Gowtham Anandha Babu @ 2014-10-31 14:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: d.kasatkin, bharat.panda, cpgs, Gowtham Anandha Babu

Changes made to decode UIH frame in btmon.
---
 monitor/rfcomm.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/monitor/rfcomm.c b/monitor/rfcomm.c
index 395a7b8..6994ffd 100644
--- a/monitor/rfcomm.c
+++ b/monitor/rfcomm.c
@@ -46,6 +46,7 @@
 
 #define GET_LEN8(length) ((length & 0xfe) >> 1)
 #define GET_LEN16(length) ((length & 0xfffe) >> 1)
+#define GET_PF(ctr) (((ctr) >> 4) & 0x1)
 
 struct rfcomm_lhdr {
 	uint8_t address;
@@ -60,8 +61,36 @@ static void print_rfcomm_hdr(const struct l2cap_frame *frame,
 {
 }
 
+static inline bool mcc_frame(const struct l2cap_frame *frame,
+						struct rfcomm_lhdr hdr)
+{
+	packet_hexdump(frame->data, frame->size);
+	return true;
+}
+
 static bool uih_frame(const struct l2cap_frame *frame, struct rfcomm_lhdr hdr)
 {
+	uint8_t credits;
+
+	struct l2cap_frame rfcomm_frame;
+
+	l2cap_frame_pull(&rfcomm_frame, frame, 0);
+
+	if (!RFCOMM_GET_CHANNEL(hdr.address)) {
+		return mcc_frame(&rfcomm_frame, hdr);
+	} else {
+		print_indent(7, opcode_color, "RFCOMM(d): UIH ", "",
+								COLOR_OFF, "");
+		print_rfcomm_hdr(&rfcomm_frame, hdr);
+		if (GET_PF(hdr.control)) {
+			if (!l2cap_frame_get_u8(&rfcomm_frame, &credits))
+				return false;
+			print_field("Credits %d", credits);
+			return true;
+		}
+	}
+
+	packet_hexdump(rfcomm_frame.data, rfcomm_frame.size);
 	return true;
 }
 
-- 
1.9.1


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

* [PATCH 4/6] monitor/rfcomm: Add support for mcc frame decoding
  2014-10-31 14:03 [PATCH 0/6] Add support for RFCOMM in btmon Gowtham Anandha Babu
                   ` (2 preceding siblings ...)
  2014-10-31 14:03 ` [PATCH 3/6] monitor/rfcomm: Add support for UIH frame decoding Gowtham Anandha Babu
@ 2014-10-31 14:03 ` Gowtham Anandha Babu
  2014-10-31 14:04 ` [PATCH 5/6] monitor/rfcomm: Add handlers for mcc frame type Gowtham Anandha Babu
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Gowtham Anandha Babu @ 2014-10-31 14:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: d.kasatkin, bharat.panda, cpgs, Gowtham Anandha Babu

Changes made to decode MCC frame in RFCOMM for btmon.
---
 monitor/rfcomm.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 80 insertions(+), 1 deletion(-)

diff --git a/monitor/rfcomm.c b/monitor/rfcomm.c
index 6994ffd..a43b2a2 100644
--- a/monitor/rfcomm.c
+++ b/monitor/rfcomm.c
@@ -44,8 +44,15 @@
 #include "sdp.h"
 #include "rfcomm.h"
 
+static char *cr_str[] = {
+	"RSP",
+	"CMD"
+};
+
+#define CR_STR(type) cr_str[GET_CR(type)]
 #define GET_LEN8(length) ((length & 0xfe) >> 1)
 #define GET_LEN16(length) ((length & 0xfffe) >> 1)
+#define GET_CR(type)	((type & 0x02) >> 1)
 #define GET_PF(ctr) (((ctr) >> 4) & 0x1)
 
 struct rfcomm_lhdr {
@@ -54,17 +61,89 @@ struct rfcomm_lhdr {
 	uint16_t length;
 } __attribute__((packed));
 
+struct rfcomm_lmcc {
+	uint8_t type;
+	uint16_t length;
+} __attribute__((packed));
+
+
 const char *opcode_color;
 
 static void print_rfcomm_hdr(const struct l2cap_frame *frame,
 						struct rfcomm_lhdr hdr)
 {
+	uint8_t pf, dlci, fcs, cr, ilen;
+	const void *ptr;
+
+	dlci = RFCOMM_GET_DLCI(hdr.address);
+	pf = GET_PF(hdr.control);
+	cr = GET_CR(hdr.address);
+	ilen = hdr.length;
+	ptr = (frame->data)+frame->size-1;
+	fcs = *(uint8_t *)(ptr);
+
+	print_field("Address : (0x%2.2x)", hdr.address);
+	print_field("CR Bit: %d", cr);
+	print_field("DLCI : (0x%2.2x)", dlci);
+	print_field("Poll/FInal Bit : %d", pf);
+	print_field("Length : %d", ilen);
+	print_field("FCS : (0x%2.2x)", fcs);
+}
+
+static const char *type2str(uint8_t type)
+{
+	switch (type) {
+	case RFCOMM_TEST:
+		return "TEST";
+	case RFCOMM_FCON:
+		return "FCON";
+	case RFCOMM_FCOFF:
+		return "FCOFF";
+	case RFCOMM_MSC:
+		return "MSC";
+	case RFCOMM_RPN:
+		return "RPN";
+	case RFCOMM_RLS:
+		return "RLS";
+	case RFCOMM_PN:
+		return "PN";
+	case RFCOMM_NSC:
+		return "NSC";
+	default:
+		return "Unknown";
+	}
 }
 
 static inline bool mcc_frame(const struct l2cap_frame *frame,
 						struct rfcomm_lhdr hdr)
 {
-	packet_hexdump(frame->data, frame->size);
+	uint8_t length, ex_length, type;
+	struct l2cap_frame rfcomm_frame;
+	struct rfcomm_lmcc mcc;
+
+	l2cap_frame_pull(&rfcomm_frame, frame, 0);
+
+	if (!l2cap_frame_get_u8(&rfcomm_frame, &mcc.type) ||
+			!l2cap_frame_get_u8(&rfcomm_frame, &length))
+		return false;
+
+	if (RFCOMM_TEST_EA(length))
+		mcc.length = (uint16_t) GET_LEN8(length);
+	else {
+		if (!l2cap_frame_get_u8(&rfcomm_frame, &ex_length))
+			return false;
+		mcc.length = ((uint16_t) length << 8) | ex_length;
+		mcc.length = GET_LEN16(hdr.length);
+	}
+
+	type = RFCOMM_GET_MCC_TYPE(mcc.type);
+
+	print_indent(7, opcode_color, "RFCOMM(s): ", "", COLOR_OFF, "%s %s",
+					type2str(type), CR_STR(mcc.type));
+
+	print_rfcomm_hdr(&rfcomm_frame, hdr);
+	packet_hexdump(rfcomm_frame.data, rfcomm_frame.size);
+
 	return true;
 }
 
-- 
1.9.1


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

* [PATCH 5/6] monitor/rfcomm: Add handlers for mcc frame type
  2014-10-31 14:03 [PATCH 0/6] Add support for RFCOMM in btmon Gowtham Anandha Babu
                   ` (3 preceding siblings ...)
  2014-10-31 14:03 ` [PATCH 4/6] monitor/rfcomm: Add support for mcc " Gowtham Anandha Babu
@ 2014-10-31 14:04 ` Gowtham Anandha Babu
  2014-10-31 14:04 ` [PATCH 6/6] monitor/rfcomm: Add mcc type handlers code Gowtham Anandha Babu
  2014-10-31 14:14 ` [PATCH 0/6] Add support for RFCOMM in btmon Vikrampal
  6 siblings, 0 replies; 10+ messages in thread
From: Gowtham Anandha Babu @ 2014-10-31 14:04 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: d.kasatkin, bharat.panda, cpgs

From: Bharat Panda <bharat.panda@samsung.com>

Changes made to decode different mcc frame type in RFCOMM
for btmon.
---
 monitor/rfcomm.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 76 insertions(+), 2 deletions(-)

diff --git a/monitor/rfcomm.c b/monitor/rfcomm.c
index a43b2a2..b85e8fd 100644
--- a/monitor/rfcomm.c
+++ b/monitor/rfcomm.c
@@ -90,6 +90,51 @@ static void print_rfcomm_hdr(const struct l2cap_frame *frame,
 	print_field("FCS : (0x%2.2x)", fcs);
 }
 
+static inline void mcc_test(const struct l2cap_frame *frame,
+				struct rfcomm_lhdr hdr, struct rfcomm_lmcc mcc)
+{
+}
+
+static inline void mcc_fcon(const struct l2cap_frame *frame,
+				struct rfcomm_lhdr hdr, struct rfcomm_lmcc mcc)
+{
+}
+
+static inline void mcc_fcoff(const struct l2cap_frame *frame,
+				struct rfcomm_lhdr hdr, struct rfcomm_lmcc mcc)
+{
+}
+
+static inline void mcc_msc(const struct l2cap_frame *frame,
+				struct rfcomm_lhdr hdr, struct rfcomm_lmcc mcc)
+{
+	packet_hexdump(frame->data, frame->size);
+}
+
+static inline void mcc_rpn(const struct l2cap_frame *frame,
+				struct rfcomm_lhdr hdr, struct rfcomm_lmcc mcc)
+{
+	packet_hexdump(frame->data, frame->size);
+}
+
+static inline void mcc_rls(const struct l2cap_frame *frame,
+				struct rfcomm_lhdr hdr, struct rfcomm_lmcc mcc)
+{
+	packet_hexdump(frame->data, frame->size);
+}
+
+static inline void mcc_pn(const struct l2cap_frame *frame,
+				struct rfcomm_lhdr hdr, struct rfcomm_lmcc mcc)
+{
+	packet_hexdump(frame->data, frame->size);
+}
+
+static inline void mcc_nsc(const struct l2cap_frame *frame,
+				struct rfcomm_lhdr hdr, struct rfcomm_lmcc mcc)
+{
+	packet_hexdump(frame->data, frame->size);
+}
+
 static const char *type2str(uint8_t type)
 {
 	switch (type) {
@@ -141,8 +186,37 @@ static inline bool mcc_frame(const struct l2cap_frame *frame,
 	print_indent(7, opcode_color, "RFCOMM(s): ", "", COLOR_OFF, "%s %s",
 					type2str(type), CR_STR(mcc.type));
 
-	print_rfcomm_hdr(&rfcomm_frame, hdr);
-	packet_hexdump(rfcomm_frame.data, rfcomm_frame.size);
+	switch (type) {
+	case RFCOMM_TEST:
+		mcc_test(&rfcomm_frame, hdr, mcc);
+		packet_hexdump(rfcomm_frame.data, rfcomm_frame.size);
+		break;
+	case RFCOMM_FCON:
+		mcc_fcon(&rfcomm_frame, hdr, mcc);
+		break;
+	case RFCOMM_FCOFF:
+		mcc_fcoff(&rfcomm_frame, hdr, mcc);
+		break;
+	case RFCOMM_MSC:
+		mcc_msc(&rfcomm_frame, hdr, mcc);
+		break;
+	case RFCOMM_RPN:
+		mcc_rpn(&rfcomm_frame, hdr, mcc);
+		break;
+	case RFCOMM_RLS:
+		mcc_rls(&rfcomm_frame, hdr, mcc);
+		break;
+	case RFCOMM_PN:
+		mcc_pn(&rfcomm_frame, hdr, mcc);
+		break;
+	case RFCOMM_NSC:
+		mcc_nsc(&rfcomm_frame, hdr, mcc);
+		break;
+	default:
+		print_field("MCC message type 0x%02x: ", type);
+		print_rfcomm_hdr(&rfcomm_frame, hdr);
+		packet_hexdump(rfcomm_frame.data, rfcomm_frame.size);
+	}
 
 	return true;
 }
-- 
1.9.1


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

* [PATCH 6/6] monitor/rfcomm: Add mcc type handlers code
  2014-10-31 14:03 [PATCH 0/6] Add support for RFCOMM in btmon Gowtham Anandha Babu
                   ` (4 preceding siblings ...)
  2014-10-31 14:04 ` [PATCH 5/6] monitor/rfcomm: Add handlers for mcc frame type Gowtham Anandha Babu
@ 2014-10-31 14:04 ` Gowtham Anandha Babu
  2014-10-31 14:14 ` [PATCH 0/6] Add support for RFCOMM in btmon Vikrampal
  6 siblings, 0 replies; 10+ messages in thread
From: Gowtham Anandha Babu @ 2014-10-31 14:04 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: d.kasatkin, bharat.panda, cpgs

From: Bharat Panda <bharat.panda@samsung.com>

Adds different mcc type handlers code to print in btmon.
---
 monitor/rfcomm.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/monitor/rfcomm.c b/monitor/rfcomm.c
index b85e8fd..10dc4e8 100644
--- a/monitor/rfcomm.c
+++ b/monitor/rfcomm.c
@@ -90,48 +90,69 @@ static void print_rfcomm_hdr(const struct l2cap_frame *frame,
 	print_field("FCS : (0x%2.2x)", fcs);
 }
 
+static void print_mcc(struct rfcomm_lmcc mcc)
+{
+	print_field("MCC Length %d", mcc.length);
+}
+
 static inline void mcc_test(const struct l2cap_frame *frame,
 				struct rfcomm_lhdr hdr, struct rfcomm_lmcc mcc)
 {
+	print_rfcomm_hdr(frame, hdr);
+	print_mcc(mcc);
 }
 
 static inline void mcc_fcon(const struct l2cap_frame *frame,
 				struct rfcomm_lhdr hdr, struct rfcomm_lmcc mcc)
 {
+	print_rfcomm_hdr(frame, hdr);
+	print_mcc(mcc);
 }
 
 static inline void mcc_fcoff(const struct l2cap_frame *frame,
 				struct rfcomm_lhdr hdr, struct rfcomm_lmcc mcc)
 {
+	print_rfcomm_hdr(frame, hdr);
+	print_mcc(mcc);
 }
 
 static inline void mcc_msc(const struct l2cap_frame *frame,
 				struct rfcomm_lhdr hdr, struct rfcomm_lmcc mcc)
 {
+	print_rfcomm_hdr(frame, hdr);
+	print_mcc(mcc);
 	packet_hexdump(frame->data, frame->size);
 }
 
 static inline void mcc_rpn(const struct l2cap_frame *frame,
 				struct rfcomm_lhdr hdr, struct rfcomm_lmcc mcc)
 {
+	print_rfcomm_hdr(frame, hdr);
+	print_mcc(mcc);
 	packet_hexdump(frame->data, frame->size);
 }
 
 static inline void mcc_rls(const struct l2cap_frame *frame,
 				struct rfcomm_lhdr hdr, struct rfcomm_lmcc mcc)
 {
+	print_rfcomm_hdr(frame, hdr);
+	print_mcc(mcc);
 	packet_hexdump(frame->data, frame->size);
 }
 
 static inline void mcc_pn(const struct l2cap_frame *frame,
 				struct rfcomm_lhdr hdr, struct rfcomm_lmcc mcc)
 {
+	print_rfcomm_hdr(frame, hdr);
+	print_mcc(mcc);
 	packet_hexdump(frame->data, frame->size);
 }
 
 static inline void mcc_nsc(const struct l2cap_frame *frame,
 				struct rfcomm_lhdr hdr, struct rfcomm_lmcc mcc)
 {
+	print_rfcomm_hdr(frame, hdr);
+	print_mcc(mcc);
 	packet_hexdump(frame->data, frame->size);
 }
 
-- 
1.9.1


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

* RE: [PATCH 0/6] Add support for RFCOMM in btmon
  2014-10-31 14:03 [PATCH 0/6] Add support for RFCOMM in btmon Gowtham Anandha Babu
                   ` (5 preceding siblings ...)
  2014-10-31 14:04 ` [PATCH 6/6] monitor/rfcomm: Add mcc type handlers code Gowtham Anandha Babu
@ 2014-10-31 14:14 ` Vikrampal
  2014-11-02 18:58   ` Luiz Augusto von Dentz
  6 siblings, 1 reply; 10+ messages in thread
From: Vikrampal @ 2014-10-31 14:14 UTC (permalink / raw)
  To: 'Gowtham Anandha Babu', linux-bluetooth
  Cc: d.kasatkin, bharat.panda, cpgs

Hi,

> -----Original Message-----
> From: linux-bluetooth-owner@vger.kernel.org [mailto:linux-bluetooth-
> owner@vger.kernel.org] On Behalf Of Gowtham Anandha Babu
> Sent: Friday, October 31, 2014 7:34 PM
> To: linux-bluetooth@vger.kernel.org
> Cc: d.kasatkin@samsung.com; bharat.panda@samsung.com;
> cpgs@samsung.com; Gowtham Anandha Babu
> Subject: [PATCH 0/6] Add support for RFCOMM in btmon
> 
> Adds an initial implementation for RFCOMM in Bluetooth monitor.
> 
> Implementation for Decoding MSC, RPN, RLS, PN, NSC frames will  be covered
> in the next patch-set.
> 
> Bharat Panda (2):
>   monitor/rfcomm: Add handlers for mcc frame type
>   monitor/rfcomm: Add mcc type handlers code
> 
> Gowtham Anandha Babu (4):
>   monitor/rfcomm: Add RFCOMM support to btmon
>   monitor/rfcomm: Add support for RFCOMM commands
>   monitor/rfcomm: Add support for UIH frame decoding
>   monitor/rfcomm: Add support for mcc frame decoding
> 
>  Makefile.tools   |   1 +
>  monitor/l2cap.c  |   4 +
>  monitor/l2cap.h  |   1 +
>  monitor/rfcomm.c | 333
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 339 insertions(+)
>  create mode 100644 monitor/rfcomm.c
> 
> --
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
in
> the body of a message to majordomo@vger.kernel.org More majordomo
> info at  http://vger.kernel.org/majordomo-info.html

Please note that android/Android.mk needs to be updated if we change
anything on the build of btmon.

Regards,
Vikram


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

* Re: [PATCH 0/6] Add support for RFCOMM in btmon
  2014-10-31 14:14 ` [PATCH 0/6] Add support for RFCOMM in btmon Vikrampal
@ 2014-11-02 18:58   ` Luiz Augusto von Dentz
  2014-11-03  5:32     ` Gowtham Anandha Babu
  0 siblings, 1 reply; 10+ messages in thread
From: Luiz Augusto von Dentz @ 2014-11-02 18:58 UTC (permalink / raw)
  To: Vikrampal
  Cc: Gowtham Anandha Babu, linux-bluetooth@vger.kernel.org,
	Dmitry Kasatkin, Bharat Panda, cpgs

Hi,

On Fri, Oct 31, 2014 at 4:14 PM, Vikrampal <vikram.pal@samsung.com> wrote:
> Hi,
>
>> -----Original Message-----
>> From: linux-bluetooth-owner@vger.kernel.org [mailto:linux-bluetooth-
>> owner@vger.kernel.org] On Behalf Of Gowtham Anandha Babu
>> Sent: Friday, October 31, 2014 7:34 PM
>> To: linux-bluetooth@vger.kernel.org
>> Cc: d.kasatkin@samsung.com; bharat.panda@samsung.com;
>> cpgs@samsung.com; Gowtham Anandha Babu
>> Subject: [PATCH 0/6] Add support for RFCOMM in btmon
>>
>> Adds an initial implementation for RFCOMM in Bluetooth monitor.
>>
>> Implementation for Decoding MSC, RPN, RLS, PN, NSC frames will  be covered
>> in the next patch-set.
>>
>> Bharat Panda (2):
>>   monitor/rfcomm: Add handlers for mcc frame type
>>   monitor/rfcomm: Add mcc type handlers code
>>
>> Gowtham Anandha Babu (4):
>>   monitor/rfcomm: Add RFCOMM support to btmon
>>   monitor/rfcomm: Add support for RFCOMM commands
>>   monitor/rfcomm: Add support for UIH frame decoding
>>   monitor/rfcomm: Add support for mcc frame decoding
>>
>>  Makefile.tools   |   1 +
>>  monitor/l2cap.c  |   4 +
>>  monitor/l2cap.h  |   1 +
>>  monitor/rfcomm.c | 333
>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  4 files changed, 339 insertions(+)
>>  create mode 100644 monitor/rfcomm.c
>>
>> --
>> 1.9.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
> in
>> the body of a message to majordomo@vger.kernel.org More majordomo
>> info at  http://vger.kernel.org/majordomo-info.html
>
> Please note that android/Android.mk needs to be updated if we change
> anything on the build of btmon.

Yes, and apparently Android.mk has not been updated so we need this
fixing before we can apply.

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

* RE: [PATCH 0/6] Add support for RFCOMM in btmon
  2014-11-02 18:58   ` Luiz Augusto von Dentz
@ 2014-11-03  5:32     ` Gowtham Anandha Babu
  0 siblings, 0 replies; 10+ messages in thread
From: Gowtham Anandha Babu @ 2014-11-03  5:32 UTC (permalink / raw)
  To: 'Luiz Augusto von Dentz', 'Vikrampal'
  Cc: linux-bluetooth, 'Dmitry Kasatkin',
	'Bharat Panda', cpgs

Hi,

> -----Original Message-----
> From: Luiz Augusto von Dentz [mailto:luiz.dentz@gmail.com]
> Sent: Monday, November 03, 2014 12:28 AM
> To: Vikrampal
> Cc: Gowtham Anandha Babu; linux-bluetooth@vger.kernel.org; Dmitry
> Kasatkin; Bharat Panda; cpgs@samsung.com
> Subject: Re: [PATCH 0/6] Add support for RFCOMM in btmon
> 
> Hi,
> 
> On Fri, Oct 31, 2014 at 4:14 PM, Vikrampal <vikram.pal@samsung.com>
> wrote:
> > Hi,
> >
> >> -----Original Message-----
> >> From: linux-bluetooth-owner@vger.kernel.org [mailto:linux-bluetooth-
> >> owner@vger.kernel.org] On Behalf Of Gowtham Anandha Babu
> >> Sent: Friday, October 31, 2014 7:34 PM
> >> To: linux-bluetooth@vger.kernel.org
> >> Cc: d.kasatkin@samsung.com; bharat.panda@samsung.com;
> >> cpgs@samsung.com; Gowtham Anandha Babu
> >> Subject: [PATCH 0/6] Add support for RFCOMM in btmon
> >>
> >> Adds an initial implementation for RFCOMM in Bluetooth monitor.
> >>
> >> Implementation for Decoding MSC, RPN, RLS, PN, NSC frames will  be
> >> covered in the next patch-set.
> >>
> >> Bharat Panda (2):
> >>   monitor/rfcomm: Add handlers for mcc frame type
> >>   monitor/rfcomm: Add mcc type handlers code
> >>
> >> Gowtham Anandha Babu (4):
> >>   monitor/rfcomm: Add RFCOMM support to btmon
> >>   monitor/rfcomm: Add support for RFCOMM commands
> >>   monitor/rfcomm: Add support for UIH frame decoding
> >>   monitor/rfcomm: Add support for mcc frame decoding
> >>
> >>  Makefile.tools   |   1 +
> >>  monitor/l2cap.c  |   4 +
> >>  monitor/l2cap.h  |   1 +
> >>  monitor/rfcomm.c | 333
> >> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >>  4 files changed, 339 insertions(+)
> >>  create mode 100644 monitor/rfcomm.c
> >>
> >> --
> >> 1.9.1
> >>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
> > in
> >> the body of a message to majordomo@vger.kernel.org More majordomo
> >> info at  http://vger.kernel.org/majordomo-info.html
> >
> > Please note that android/Android.mk needs to be updated if we change
> > anything on the build of btmon.
> 
> Yes, and apparently Android.mk has not been updated so we need this fixing
> before we can apply.

I have updated the Andoird.mk file and submitted v1 for the same. Thanks for pointing out the mistake. 

Regards,
Gowtham Anandha Babu


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

end of thread, other threads:[~2014-11-03  5:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-31 14:03 [PATCH 0/6] Add support for RFCOMM in btmon Gowtham Anandha Babu
2014-10-31 14:03 ` [PATCH 1/6] monitor/rfcomm: Add RFCOMM support to btmon Gowtham Anandha Babu
2014-10-31 14:03 ` [PATCH 2/6] monitor/rfcomm: Add support for RFCOMM commands Gowtham Anandha Babu
2014-10-31 14:03 ` [PATCH 3/6] monitor/rfcomm: Add support for UIH frame decoding Gowtham Anandha Babu
2014-10-31 14:03 ` [PATCH 4/6] monitor/rfcomm: Add support for mcc " Gowtham Anandha Babu
2014-10-31 14:04 ` [PATCH 5/6] monitor/rfcomm: Add handlers for mcc frame type Gowtham Anandha Babu
2014-10-31 14:04 ` [PATCH 6/6] monitor/rfcomm: Add mcc type handlers code Gowtham Anandha Babu
2014-10-31 14:14 ` [PATCH 0/6] Add support for RFCOMM in btmon Vikrampal
2014-11-02 18:58   ` Luiz Augusto von Dentz
2014-11-03  5:32     ` Gowtham Anandha Babu

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).