All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v4 3/6] l2test: Add support for BT_MODE_EXT_FLOWCTL
Date: Fri, 20 Mar 2020 13:40:35 -0700	[thread overview]
Message-ID: <20200320204038.11799-3-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20200320204038.11799-1-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This enables using l2test to connect or listen with
BT_MODE_EXT_FLOWCTL.
---
 tools/l2test.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/tools/l2test.c b/tools/l2test.c
index 8c6e08646..0d846ed93 100644
--- a/tools/l2test.c
+++ b/tools/l2test.c
@@ -143,13 +143,14 @@ struct lookup_table {
 };
 
 static struct lookup_table l2cap_modes[] = {
-	{ "basic",	L2CAP_MODE_BASIC	},
+	{ "basic",	BT_MODE_BASIC		},
 	/* Not implemented
-	{ "flowctl",	L2CAP_MODE_FLOWCTL	},
-	{ "retrans",	L2CAP_MODE_RETRANS	},
+	{ "flowctl",	BT_MODE_FLOWCTL		},
+	{ "retrans",	BT_MODE_RETRANS		},
 	*/
-	{ "ertm",	L2CAP_MODE_ERTM		},
-	{ "streaming",	L2CAP_MODE_STREAMING	},
+	{ "ertm",	BT_MODE_ERTM		},
+	{ "streaming",	BT_MODE_STREAMING	},
+	{ "ext-flowctl",BT_MODE_EXT_FLOWCTL	},
 	{ 0 }
 };
 
@@ -283,7 +284,7 @@ static int getopts(int sk, struct l2cap_options *opts, bool connected)
 
 	memset(opts, 0, sizeof(*opts));
 
-	if (bdaddr_type == BDADDR_BREDR) {
+	if (bdaddr_type == BDADDR_BREDR || rfcmode) {
 		optlen = sizeof(*opts);
 		return getsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, opts, &optlen);
 	}
@@ -303,6 +304,13 @@ static int setopts(int sk, struct l2cap_options *opts)
 		return setsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, opts,
 								sizeof(*opts));
 
+	if (opts->mode) {
+		if (setsockopt(sk, SOL_BLUETOOTH, BT_MODE, &opts->mode,
+						sizeof(opts->mode)) < 0) {
+			return -errno;
+		}
+	}
+
 	return setsockopt(sk, SOL_BLUETOOTH, BT_RCVMTU, &opts->imtu,
 							sizeof(opts->imtu));
 }
-- 
2.21.1


  parent reply	other threads:[~2020-03-20 20:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20 20:40 [PATCH v4 1/6] lib: Add definitions for Enhanced Credits Based Mode Luiz Augusto von Dentz
2020-03-20 20:40 ` [PATCH v4 2/6] btio: Add mode to for Enhanced Credit Mode Luiz Augusto von Dentz
2020-03-20 20:40 ` Luiz Augusto von Dentz [this message]
2020-03-20 20:40 ` [PATCH v4 4/6] emulator/bthost: Add support for ECRED Connection request/response Luiz Augusto von Dentz
2020-03-20 20:40 ` [PATCH v4 5/6] tools/l2cap-tester: Add test for Ext-Flowctl mode Luiz Augusto von Dentz
2020-03-20 20:40 ` [PATCH v4 6/6] gatt: Enable connecting to EATT channel using " Luiz Augusto von Dentz
2020-03-30 22:24 ` [PATCH v4 1/6] lib: Add definitions for Enhanced Credits Based Mode Luiz Augusto von Dentz

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=20200320204038.11799-3-luiz.dentz@gmail.com \
    --to=luiz.dentz@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 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.