All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vikrampal Yadav <vikram.pal@samsung.com>
To: linux-bluetooth@vger.kernel.org
Cc: luiz.dentz@gmail.com, d.kasatkin@samsung.com,
	vikram.pal@samsung.com, cpgs@samsung.com
Subject: [PATCH 6/7] monitor: Add support for parsing L2CAP control field
Date: Fri, 21 Nov 2014 19:17:44 +0530	[thread overview]
Message-ID: <1416577665-21876-7-git-send-email-vikram.pal@samsung.com> (raw)
In-Reply-To: <1416577665-21876-1-git-send-email-vikram.pal@samsung.com>

Support for parsing L2CAP control field added.
---
 monitor/l2cap.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/monitor/l2cap.c b/monitor/l2cap.c
index f5ee0cd..16959df 100644
--- a/monitor/l2cap.c
+++ b/monitor/l2cap.c
@@ -416,6 +416,38 @@ static void l2cap_ctrl_ext_parse(struct l2cap_frame *frame, uint32_t ctrl)
 		printf(" F-bit");
 }
 
+static void l2cap_ctrl_parse(struct l2cap_frame *frame, uint32_t ctrl)
+{
+	printf("      %s:",
+			ctrl & L2CAP_CTRL_FRAME_TYPE ? "S-frame" : "I-frame");
+
+	if (ctrl & 0x01) {
+		printf(" %s",
+			supervisory2str((ctrl & L2CAP_CTRL_SUPERVISE_MASK) >>
+						L2CAP_CTRL_SUPER_SHIFT));
+
+		if (ctrl & L2CAP_CTRL_POLL)
+			printf(" P-bit");
+	} else {
+		uint8_t sar = (ctrl & L2CAP_CTRL_SAR_MASK) >> L2CAP_CTRL_SAR_SHIFT;
+		printf(" %s", sar2str(sar));
+		if (sar == L2CAP_SAR_START) {
+			uint16_t len;
+
+			if (!l2cap_frame_get_le16(frame, &len))
+				return;
+
+			printf(" (len %d)", len);
+		}
+		printf(" TxSeq %d", (ctrl & L2CAP_CTRL_TXSEQ_MASK) >> L2CAP_CTRL_TXSEQ_SHIFT);
+	}
+
+	printf(" ReqSeq %d", (ctrl & L2CAP_CTRL_REQSEQ_MASK) >> L2CAP_CTRL_REQSEQ_SHIFT);
+
+	if (ctrl & L2CAP_CTRL_FINAL)
+		printf(" F-bit");
+}
+
 #define MAX_INDEX 16
 
 struct index_data {
@@ -2828,6 +2860,8 @@ static void l2cap_frame(uint16_t index, bool in, uint16_t handle,
 						" [PSM %d mode %d] {chan %d}",
 						cid, size, ctrl16, frame.psm,
 						frame.mode, frame.chan);
+
+				l2cap_ctrl_parse(&frame, ctrl16);
 			}
 
 			printf("\n");
-- 
1.9.1


  parent reply	other threads:[~2014-11-21 13:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-21 13:47 [PATCH 0/7] L2CAP control field + AVRCP browsing PDU parsing Vikrampal Yadav
2014-11-21 13:47 ` [PATCH 1/7] monitor: Adjust for ERTM control bytes Vikrampal Yadav
2014-11-28  8:37   ` Luiz Augusto von Dentz
2014-12-03  7:05     ` Vikrampal
2014-12-03  8:20       ` Luiz Augusto von Dentz
2014-11-21 13:47 ` [PATCH 2/7] monitor: Make the parameter name generic Vikrampal Yadav
2014-11-21 13:47 ` [PATCH 3/7] monitor: Add functionality to store extented control in DB Vikrampal Yadav
2014-11-21 13:47 ` [PATCH 4/7] monitor: Extract extended L2CAP extended control field Vikrampal Yadav
2014-11-21 13:47 ` [PATCH 5/7] monitor: Add support for parsing " Vikrampal Yadav
2014-11-21 13:47 ` Vikrampal Yadav [this message]
2014-11-21 13:47 ` [PATCH 7/7] monitor: Add AVRCP SetBrowsedPlayer support Vikrampal Yadav
2014-11-28  8:37 ` [PATCH 0/7] L2CAP control field + AVRCP browsing PDU parsing Luiz Augusto von Dentz
2014-12-03  7:08   ` Vikrampal
2014-12-03  8:02     ` Luiz Augusto von Dentz
2014-12-03  8:57       ` Vikrampal

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=1416577665-21876-7-git-send-email-vikram.pal@samsung.com \
    --to=vikram.pal@samsung.com \
    --cc=cpgs@samsung.com \
    --cc=d.kasatkin@samsung.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.