linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] MGMT Stop Discovery command LE-Only support
@ 2012-01-13 21:03 Andre Guedes
  2012-01-13 21:03 ` [PATCH 1/3] Bluetooth: Add hci_cancel_le_scan() to hci_core Andre Guedes
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andre Guedes @ 2012-01-13 21:03 UTC (permalink / raw)
  To: linux-bluetooth

Hi all,

This patch series adds LE-only support to Stop Discovery MGMT
command.

This series depends on the last series sent "MGMT Start Discovery
command LE-Only Support"

BR,

Andre

Andre Guedes (3):
  Bluetooth: Add hci_cancel_le_scan() to hci_core
  Bluetooth: Consider DISCOVERY_LE_SCAN state in hci_discovery_active
  Bluetooth: MGMT stop discovery LE support

 include/net/bluetooth/hci_core.h |    1 +
 net/bluetooth/hci_core.c         |   19 +++++++++++++++++++
 net/bluetooth/mgmt.c             |    9 +++++++++
 3 files changed, 29 insertions(+), 0 deletions(-)

-- 
1.7.8.3


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

* [PATCH 1/3] Bluetooth: Add hci_cancel_le_scan() to hci_core
  2012-01-13 21:03 [PATCH 0/3] MGMT Stop Discovery command LE-Only support Andre Guedes
@ 2012-01-13 21:03 ` Andre Guedes
  2012-01-13 21:03 ` [PATCH 2/3] Bluetooth: Consider DISCOVERY_LE_SCAN state in hci_discovery_active Andre Guedes
  2012-01-13 21:03 ` [PATCH 3/3] Bluetooth: MGMT stop discovery LE support Andre Guedes
  2 siblings, 0 replies; 4+ messages in thread
From: Andre Guedes @ 2012-01-13 21:03 UTC (permalink / raw)
  To: linux-bluetooth

This patch adds to hci_core the hci_cancel_le_scan function which
should be used to cancel an ongoing LE scan.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
---
 include/net/bluetooth/hci_core.h |    1 +
 net/bluetooth/hci_core.c         |   18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 114d1a5..a29ecaa 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -992,5 +992,6 @@ int hci_do_inquiry(struct hci_dev *hdev, u8 length);
 int hci_cancel_inquiry(struct hci_dev *hdev);
 int hci_do_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window,
 								int timeout);
+int hci_cancel_le_scan(struct hci_dev *hdev);
 
 #endif /* __HCI_CORE_H */
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index ca0fffb..ae765c4 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2819,5 +2819,23 @@ int hci_do_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window,
 	return 0;
 }
 
+int hci_cancel_le_scan(struct hci_dev *hdev)
+{
+	int pending;
+
+	BT_DBG("%s", hdev->name);
+
+	pending = cancel_work_sync(&hdev->le_scan_enable);
+	if (pending)
+		return 0;
+
+	if (!test_bit(HCI_LE_SCAN, &hdev->dev_flags))
+		return -EPERM;
+
+	flush_delayed_work_sync(&hdev->le_scan_disable);
+
+	return 0;
+}
+
 module_param(enable_hs, bool, 0644);
 MODULE_PARM_DESC(enable_hs, "Enable High Speed");
-- 
1.7.8.3


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

* [PATCH 2/3] Bluetooth: Consider DISCOVERY_LE_SCAN state in hci_discovery_active
  2012-01-13 21:03 [PATCH 0/3] MGMT Stop Discovery command LE-Only support Andre Guedes
  2012-01-13 21:03 ` [PATCH 1/3] Bluetooth: Add hci_cancel_le_scan() to hci_core Andre Guedes
@ 2012-01-13 21:03 ` Andre Guedes
  2012-01-13 21:03 ` [PATCH 3/3] Bluetooth: MGMT stop discovery LE support Andre Guedes
  2 siblings, 0 replies; 4+ messages in thread
From: Andre Guedes @ 2012-01-13 21:03 UTC (permalink / raw)
  To: linux-bluetooth

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
---
 net/bluetooth/hci_core.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index ae765c4..6d6d3db 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -384,6 +384,7 @@ bool hci_discovery_active(struct hci_dev *hdev)
 	struct discovery_state *discov = &hdev->discovery;
 
 	if (discov->state == DISCOVERY_INQUIRY ||
+					discov->state == DISCOVERY_LE_SCAN ||
 					discov->state == DISCOVERY_RESOLVING)
 		return true;
 
-- 
1.7.8.3


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

* [PATCH 3/3] Bluetooth: MGMT stop discovery LE support
  2012-01-13 21:03 [PATCH 0/3] MGMT Stop Discovery command LE-Only support Andre Guedes
  2012-01-13 21:03 ` [PATCH 1/3] Bluetooth: Add hci_cancel_le_scan() to hci_core Andre Guedes
  2012-01-13 21:03 ` [PATCH 2/3] Bluetooth: Consider DISCOVERY_LE_SCAN state in hci_discovery_active Andre Guedes
@ 2012-01-13 21:03 ` Andre Guedes
  2 siblings, 0 replies; 4+ messages in thread
From: Andre Guedes @ 2012-01-13 21:03 UTC (permalink / raw)
  To: linux-bluetooth

This patch adds support to MGMT stop discovery command so now we are
able to cancel LE-based discovery procedures.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
---
 net/bluetooth/mgmt.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 05e6c1f..a8b60dc 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2000,6 +2000,15 @@ static int stop_discovery(struct sock *sk, u16 index)
 		goto unlock;
 	}
 
+	if (hdev->discovery.state == DISCOVERY_LE_SCAN) {
+		err = hci_cancel_le_scan(hdev);
+		if (err < 0)
+			mgmt_pending_remove(cmd);
+		else
+			hci_discovery_set_state(hdev, DISCOVERY_STOPPING);
+		goto unlock;
+	}
+
 	e = hci_inquiry_cache_lookup_resolve(hdev, BDADDR_ANY, NAME_PENDING);
 	if (!e) {
 		mgmt_pending_remove(cmd);
-- 
1.7.8.3


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

end of thread, other threads:[~2012-01-13 21:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-13 21:03 [PATCH 0/3] MGMT Stop Discovery command LE-Only support Andre Guedes
2012-01-13 21:03 ` [PATCH 1/3] Bluetooth: Add hci_cancel_le_scan() to hci_core Andre Guedes
2012-01-13 21:03 ` [PATCH 2/3] Bluetooth: Consider DISCOVERY_LE_SCAN state in hci_discovery_active Andre Guedes
2012-01-13 21:03 ` [PATCH 3/3] Bluetooth: MGMT stop discovery LE support Andre Guedes

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).