summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2010-11-10 19:56:01 -0200
committerJohan Hedberg <johan.hedberg@nokia.com>2010-11-11 15:28:21 +0200
commit85d533a33bb9367c72b10a66a21a8502f81f2df9 (patch)
tree34d961d57c384ee267e1d2be0099560cc29921ab
parent01084686e1a0480d3e6179cf6373c6c5c56c82ca (diff)
Add a new configuration option to disable Low Energy support
Disable LE interleave discovery and attribute server over LE link. Option required to force disabling Low energy support for LE capable adapters.
-rw-r--r--src/adapter.c2
-rw-r--r--src/attrib-server.c4
-rw-r--r--src/hcid.h1
-rw-r--r--src/main.c7
-rw-r--r--src/main.conf7
5 files changed, 19 insertions, 2 deletions
diff --git a/src/adapter.c b/src/adapter.c
index 31014e55..b1aabbdb 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2082,7 +2082,7 @@ static int adapter_setup(struct btd_adapter *adapter, const char *mode)
if (dev->features[7] & LMP_INQ_TX_PWR)
adapter_ops->read_inq_tx_pwr(adapter->dev_id);
- if (dev->features[4] & LMP_LE) {
+ if ((dev->features[4] & LMP_LE) && main_opts.le) {
uint8_t simul = (dev->features[6] & LMP_LE_BREDR) ? 0x01 : 0x00;
err = adapter_ops->write_le_host(adapter->dev_id, 0x01, simul);
if (err < 0) {
diff --git a/src/attrib-server.c b/src/attrib-server.c
index f6440914..375b7310 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -40,6 +40,7 @@
#include "glib-helper.h"
#include "btio.h"
#include "sdpd.h"
+#include "hcid.h"
#include "att.h"
#include "gattrib.h"
@@ -623,6 +624,9 @@ int attrib_server_init(void)
sdp_handle = record->handle;
+ if (!main_opts.le)
+ return 0;
+
/* LE socket */
le_io = bt_io_listen(BT_IO_L2CAP, NULL, confirm_event,
NULL, NULL, &gerr,
diff --git a/src/hcid.h b/src/hcid.h
index 48d489a5..a9484a6f 100644
--- a/src/hcid.h
+++ b/src/hcid.h
@@ -56,6 +56,7 @@ struct main_opts {
gboolean name_resolv;
gboolean debug_keys;
gboolean attrib_server;
+ gboolean le;
uint8_t scan;
uint8_t mode;
diff --git a/src/main.c b/src/main.c
index adbb374a..9abdd60e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -222,6 +222,13 @@ static void parse_config(GKeyFile *config)
else
main_opts.attrib_server = boolean;
+ boolean = g_key_file_get_boolean(config, "General",
+ "EnableLE", &err);
+ if (err)
+ g_clear_error(&err);
+ else
+ main_opts.le = boolean;
+
main_opts.link_mode = HCI_LM_ACCEPT;
main_opts.link_policy = HCI_LP_RSWITCH | HCI_LP_SNIFF |
diff --git a/src/main.conf b/src/main.conf
index f92bf420..c03f135c 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -56,6 +56,11 @@ NameResolving = true
# that they were created for.
DebugKeys = false
+# Enable Low Energy support if the dongle supports. Default is false.
+# Enable/Disable interleave discovery and attribute server over LE.
+EnableLE = false
+
# Enable the GATT Attribute Server. Default is false, because it is only
-# useful for testing.
+# useful for testing. Attribute server is not enabled over LE if EnableLE
+# is false.
AttributeServer = false