summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Guedes <andre.guedes@openbossa.org>2012-02-17 20:39:36 -0300
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-19 12:33:49 +0200
commit4aab14e5504e84c42534378f91e836e6f55d0886 (patch)
tree9378f2f0d3e345788e8853b3bb7ea2fa4d70558e
parentf39799f5047c4827b200acbf33cd0ba076afd7ed (diff)
downloadlinux-4aab14e5504e84c42534378f91e836e6f55d0886.tar.gz
linux-4aab14e5504e84c42534378f91e836e6f55d0886.tar.bz2
linux-4aab14e5504e84c42534378f91e836e6f55d0886.zip
Bluetooth: Track discovery type
This patch adds to struct discovery_state the field 'type' so that we can track the discovery type the device is performing. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r--include/net/bluetooth/hci_core.h1
-rw-r--r--net/bluetooth/hci_core.c2
-rw-r--r--net/bluetooth/mgmt.c4
3 files changed, 6 insertions, 1 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index be8da5d54abb..d7c79b5335c2 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -57,6 +57,7 @@ struct inquiry_entry {
};
struct discovery_state {
+ int type;
enum {
DISCOVERY_STOPPED,
DISCOVERY_STARTING,
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index dc31e7d6028e..29a9b01c3b9b 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -380,6 +380,8 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
switch (state) {
case DISCOVERY_STOPPED:
+ hdev->discovery.type = 0;
+
if (hdev->discovery.state != DISCOVERY_STARTING)
mgmt_discovering(hdev, 0);
break;
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 196215c9d424..9d98382e48c7 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2192,7 +2192,9 @@ static int start_discovery(struct sock *sk, u16 index,
goto failed;
}
- switch (cp->type) {
+ hdev->discovery.type = cp->type;
+
+ switch (hdev->discovery.type) {
case DISCOV_TYPE_BREDR:
case DISCOV_TYPE_INTERLEAVED:
err = hci_do_inquiry(hdev, INQUIRY_LEN_BREDR);