From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v3 6/6] gatt: Enable connecting to EATT channel using Ext-Flowctl mode
Date: Wed, 18 Mar 2020 14:51:24 -0700 [thread overview]
Message-ID: <20200318215124.21880-6-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20200318215124.21880-1-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This makes use of BT_IO_MODE_EXT_FLOWCTL to connect to EATT channels.
---
src/gatt-client.c | 34 +++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/src/gatt-client.c b/src/gatt-client.c
index 20efb7ae9..a9bfc2802 100644
--- a/src/gatt-client.c
+++ b/src/gatt-client.c
@@ -2182,9 +2182,13 @@ static void eatt_connect(struct btd_gatt_client *client)
ba2str(device_get_address(dev), addr);
- DBG("Connection attempt to: %s", addr);
-
for (i = bt_att_get_channels(att); i < main_opts.gatt_channels; i++) {
+ int defer_timeout = i + 1 < main_opts.gatt_channels ? 1 : 0;
+
+ DBG("Connection attempt to: %s defer %s", addr,
+ defer_timeout ? "true" : "false");
+
+ /* Attempt to connect using the Ext-Flowctl */
io = bt_io_connect(eatt_connect_cb, client, NULL, &gerr,
BT_IO_OPT_SOURCE_BDADDR,
btd_adapter_get_address(adapter),
@@ -2194,15 +2198,35 @@ static void eatt_connect(struct btd_gatt_client *client)
device_get_address(dev),
BT_IO_OPT_DEST_TYPE,
device_get_le_address_type(dev),
+ BT_IO_OPT_MODE, BT_IO_MODE_EXT_FLOWCTL,
BT_IO_OPT_PSM, BT_ATT_EATT_PSM,
BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
BT_IO_OPT_MTU, main_opts.gatt_mtu,
+ BT_IO_OPT_DEFER_TIMEOUT, defer_timeout,
BT_IO_OPT_INVALID);
if (!io) {
- error("EATT bt_io_connect(%s): %s", addr,
- gerr->message);
g_error_free(gerr);
- return;
+ gerr = NULL;
+ /* Fallback to legacy LE Mode */
+ io = bt_io_connect(eatt_connect_cb, client, NULL, &gerr,
+ BT_IO_OPT_SOURCE_BDADDR,
+ btd_adapter_get_address(adapter),
+ BT_IO_OPT_SOURCE_TYPE,
+ btd_adapter_get_address_type(adapter),
+ BT_IO_OPT_DEST_BDADDR,
+ device_get_address(dev),
+ BT_IO_OPT_DEST_TYPE,
+ device_get_le_address_type(dev),
+ BT_IO_OPT_PSM, BT_ATT_EATT_PSM,
+ BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
+ BT_IO_OPT_MTU, main_opts.gatt_mtu,
+ BT_IO_OPT_INVALID);
+ if (!io) {
+ error("EATT bt_io_connect(%s): %s", addr,
+ gerr->message);
+ g_error_free(gerr);
+ return;
+ }
}
g_io_channel_unref(io);
--
2.21.1
prev parent reply other threads:[~2020-03-18 21:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-18 21:51 [PATCH v3 1/6] lib: Add definitions for Enhanced Credits Based Mode Luiz Augusto von Dentz
2020-03-18 21:51 ` [PATCH v3 2/6] btio: Add mode to for Enhanced Credit Mode Luiz Augusto von Dentz
2020-03-18 21:51 ` [PATCH v3 3/6] l2test: Add support for BT_MODE_EXT_FLOWCTL Luiz Augusto von Dentz
2020-03-18 21:51 ` [PATCH v3 4/6] emulator/bthost: Add support for ECRED Connection request/response Luiz Augusto von Dentz
2020-03-18 21:51 ` [PATCH v3 5/6] tools/l2cap-tester: Add test for Ext-Flowctl mode Luiz Augusto von Dentz
2020-03-18 21:51 ` Luiz Augusto von Dentz [this message]
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=20200318215124.21880-6-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 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).