All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/2] Remove EnableLE option from the user-space
@ 2011-08-19 20:30 Claudio Takahasi
  2011-08-19 20:30 ` [PATCH BlueZ 2/2] Read local extended features at the initialization Claudio Takahasi
  2011-08-22 10:40 ` [PATCH BlueZ 1/2] Remove EnableLE option from the user-space Johan Hedberg
  0 siblings, 2 replies; 3+ messages in thread
From: Claudio Takahasi @ 2011-08-19 20:30 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Deprecated configure option after adding "enable_le" parameter in the
bluetooth module. Write LE Host Supported Command is now sent by the
kernel if "enable_le" is enabled and the controller supports LE.
---
 plugins/hciops.c    |   24 +-----------------------
 plugins/mgmtops.c   |    7 -------
 src/adapter.c       |    3 ---
 src/adapter.h       |    1 -
 src/attrib-server.c |    3 ---
 src/hcid.h          |    1 -
 src/main.c          |    7 -------
 src/main.conf       |    7 +------
 8 files changed, 2 insertions(+), 51 deletions(-)

diff --git a/plugins/hciops.c b/plugins/hciops.c
index ecc0e86..0f8f79d 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
@@ -208,7 +208,7 @@ static inline gboolean is_le_capable(int index)
 {
 	struct dev_info *dev = &devs[index];
 
-	return (main_opts.le && dev->features[4] & LMP_LE &&
+	return (dev->features[4] & LMP_LE &&
 			dev->extfeatures[0] & LMP_HOST_LE) ? TRUE : FALSE;
 }
 
@@ -3307,27 +3307,6 @@ static int hciops_passkey_reply(int index, bdaddr_t *bdaddr, uint32_t passkey)
 	return err;
 }
 
-static int hciops_enable_le(int index)
-{
-	struct dev_info *dev = &devs[index];
-	write_le_host_supported_cp cp;
-
-	DBG("hci%d", index);
-
-	if (!(dev->features[4] & LMP_LE))
-		return -ENOTSUP;
-
-	cp.le = 0x01;
-	cp.simul = (dev->features[6] & LMP_LE_BREDR) ? 0x01 : 0x00;
-
-	if (hci_send_cmd(dev->sk, OGF_HOST_CTL,
-				OCF_WRITE_LE_HOST_SUPPORTED,
-				WRITE_LE_HOST_SUPPORTED_CP_SIZE, &cp) < 0)
-		return -errno;
-
-	return 0;
-}
-
 static uint8_t generate_service_class(int index)
 {
 	struct dev_info *dev = &devs[index];
@@ -3658,7 +3637,6 @@ static struct btd_adapter_ops hci_ops = {
 	.pincode_reply = hciops_pincode_reply,
 	.confirm_reply = hciops_confirm_reply,
 	.passkey_reply = hciops_passkey_reply,
-	.enable_le = hciops_enable_le,
 	.encrypt_link = hciops_encrypt_link,
 	.set_did = hciops_set_did,
 	.add_uuid = hciops_add_uuid,
diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index 3cdb97e..0f0cfd5 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
@@ -1820,12 +1820,6 @@ static int mgmt_passkey_reply(int index, bdaddr_t *bdaddr, uint32_t passkey)
 	return -ENOSYS;
 }
 
-static int mgmt_enable_le(int index)
-{
-	DBG("index %d", index);
-	return -ENOSYS;
-}
-
 static int mgmt_encrypt_link(int index, bdaddr_t *dst, bt_hci_result_t cb,
 							gpointer user_data)
 {
@@ -2053,7 +2047,6 @@ static struct btd_adapter_ops mgmt_ops = {
 	.pincode_reply = mgmt_pincode_reply,
 	.confirm_reply = mgmt_confirm_reply,
 	.passkey_reply = mgmt_passkey_reply,
-	.enable_le = mgmt_enable_le,
 	.encrypt_link = mgmt_encrypt_link,
 	.set_did = mgmt_set_did,
 	.add_uuid = mgmt_add_uuid,
diff --git a/src/adapter.c b/src/adapter.c
index 4c88a0e..eb37580 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2274,9 +2274,6 @@ void btd_adapter_start(struct btd_adapter *adapter)
 	adapter->mode = MODE_CONNECTABLE;
 	adapter->off_timer = 0;
 
-	if (main_opts.le)
-		adapter_ops->enable_le(adapter->dev_id);
-
 	adapter_ops->set_name(adapter->dev_id, adapter->name);
 
 	if (read_local_class(&adapter->bdaddr, cls) < 0) {
diff --git a/src/adapter.h b/src/adapter.h
index 687275a..f1f546c 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -203,7 +203,6 @@ struct btd_adapter_ops {
 							size_t pin_len);
 	int (*confirm_reply) (int index, bdaddr_t *bdaddr, gboolean success);
 	int (*passkey_reply) (int index, bdaddr_t *bdaddr, uint32_t passkey);
-	int (*enable_le) (int index);
 	int (*encrypt_link) (int index, bdaddr_t *bdaddr, bt_hci_result_t cb,
 							gpointer user_data);
 	int (*set_did) (int index, uint16_t vendor, uint16_t product,
diff --git a/src/attrib-server.c b/src/attrib-server.c
index c02d575..0bda1e3 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -1094,9 +1094,6 @@ int attrib_server_init(void)
 	if (!register_core_services())
 		goto failed;
 
-	if (!main_opts.le)
-		return 0;
-
 	/* LE socket */
 	le_io = bt_io_listen(BT_IO_L2CAP, NULL, confirm_event,
 					&le_io, NULL, &gerr,
diff --git a/src/hcid.h b/src/hcid.h
index ea038e9..ef25c79 100644
--- a/src/hcid.h
+++ b/src/hcid.h
@@ -38,7 +38,6 @@ struct main_opts {
 	gboolean	name_resolv;
 	gboolean	debug_keys;
 	gboolean	attrib_server;
-	gboolean	le;
 
 	uint8_t		mode;
 	uint8_t		discov_interval;
diff --git a/src/main.c b/src/main.c
index b161a98..7fecc5a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -217,13 +217,6 @@ 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 8cd132f..a9e2060 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -56,11 +56,6 @@ 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. Attribute server is not enabled over LE if EnableLE
-# is false.
+# useful for testing.
 AttributeServer = false
-- 
1.7.6


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

* [PATCH BlueZ 2/2] Read local extended features at the initialization
  2011-08-19 20:30 [PATCH BlueZ 1/2] Remove EnableLE option from the user-space Claudio Takahasi
@ 2011-08-19 20:30 ` Claudio Takahasi
  2011-08-22 10:40 ` [PATCH BlueZ 1/2] Remove EnableLE option from the user-space Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Claudio Takahasi @ 2011-08-19 20:30 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Local extended features bitmask may change when Write LE Host Supported
Command is sent by the kernel. This patch adds reading of the local
extended features in the initialization sending a HCI command, extend
the ioctl HCIGETDEVINFO is not suitable due possible inconsistency
between kernel and userspace.
---
 plugins/hciops.c |   24 +++++++-----------------
 1 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/plugins/hciops.c b/plugins/hciops.c
index 0f8f79d..ddff544 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
@@ -1372,20 +1372,6 @@ static inline void remote_features_notify(int index, void *ptr)
 	write_features_info(&dev->bdaddr, &evt->bdaddr, NULL, evt->features);
 }
 
-static void write_le_host_complete(int index, uint8_t status)
-{
-	struct dev_info *dev = &devs[index];
-	uint8_t page_num = 0x01;
-
-	if (status)
-		return;
-
-	if (hci_send_cmd(dev->sk, OGF_INFO_PARAM,
-				OCF_READ_LOCAL_EXT_FEATURES, 1, &page_num) < 0)
-		error("Unable to read extended local features: %s (%d)",
-						strerror(errno), errno);
-}
-
 static void read_local_version_complete(int index,
 				const read_local_version_rp *rp)
 {
@@ -1801,9 +1787,6 @@ static inline void cmd_complete(int index, void *ptr)
 	case cmd_opcode_pack(OGF_LINK_CTL, OCF_INQUIRY_CANCEL):
 		cc_inquiry_cancel(index, status);
 		break;
-	case cmd_opcode_pack(OGF_HOST_CTL, OCF_WRITE_LE_HOST_SUPPORTED):
-		write_le_host_complete(index, status);
-		break;
 	case cmd_opcode_pack(OGF_LE_CTL, OCF_LE_SET_SCAN_ENABLE):
 		cc_le_set_scan_enable(index, status);
 		break;
@@ -2498,6 +2481,13 @@ static void device_devup_setup(int index)
 	bacpy(&dev->bdaddr, &di.bdaddr);
 	memcpy(dev->features, di.features, 8);
 
+	if (dev->features[7] & LMP_EXT_FEAT) {
+		uint8_t page_num = 0x01;
+
+		hci_send_cmd(dev->sk, OGF_INFO_PARAM,
+				OCF_READ_LOCAL_EXT_FEATURES, 1, &page_num);
+	}
+
 	/* Set page timeout */
 	if ((main_opts.flags & (1 << HCID_SET_PAGETO))) {
 		write_page_timeout_cp cp;
-- 
1.7.6


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

* Re: [PATCH BlueZ 1/2] Remove EnableLE option from the user-space
  2011-08-19 20:30 [PATCH BlueZ 1/2] Remove EnableLE option from the user-space Claudio Takahasi
  2011-08-19 20:30 ` [PATCH BlueZ 2/2] Read local extended features at the initialization Claudio Takahasi
@ 2011-08-22 10:40 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2011-08-22 10:40 UTC (permalink / raw)
  To: Claudio Takahasi; +Cc: linux-bluetooth

Hi Claudio,

On Fri, Aug 19, 2011, Claudio Takahasi wrote:
> Deprecated configure option after adding "enable_le" parameter in the
> bluetooth module. Write LE Host Supported Command is now sent by the
> kernel if "enable_le" is enabled and the controller supports LE.
> ---
>  plugins/hciops.c    |   24 +-----------------------
>  plugins/mgmtops.c   |    7 -------
>  src/adapter.c       |    3 ---
>  src/adapter.h       |    1 -
>  src/attrib-server.c |    3 ---
>  src/hcid.h          |    1 -
>  src/main.c          |    7 -------
>  src/main.conf       |    7 +------
>  8 files changed, 2 insertions(+), 51 deletions(-)

Both patches have been applied. Thanks.

Johan

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

end of thread, other threads:[~2011-08-22 10:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-19 20:30 [PATCH BlueZ 1/2] Remove EnableLE option from the user-space Claudio Takahasi
2011-08-19 20:30 ` [PATCH BlueZ 2/2] Read local extended features at the initialization Claudio Takahasi
2011-08-22 10:40 ` [PATCH BlueZ 1/2] Remove EnableLE option from the user-space Johan Hedberg

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.