Bluetooth: Track discovery type
authorAndre Guedes <andre.guedes@openbossa.org>
Fri, 17 Feb 2012 23:39:36 +0000 (20:39 -0300)
committerJohan Hedberg <johan.hedberg@intel.com>
Sun, 19 Feb 2012 10:33:49 +0000 (12:33 +0200)
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>
include/net/bluetooth/hci_core.h
net/bluetooth/hci_core.c
net/bluetooth/mgmt.c

index be8da5d54abba4ce8ac745269b4cd55a17aa7b1a..d7c79b5335c2fb58d988ff5233d8f0a9653d487b 100644 (file)
@@ -57,6 +57,7 @@ struct inquiry_entry {
 };
 
 struct discovery_state {
+       int type;
        enum {
                DISCOVERY_STOPPED,
                DISCOVERY_STARTING,
index dc31e7d6028e33ae1f409a52c453deaad380ae0c..29a9b01c3b9ba505f2d38340968275812198a322 100644 (file)
@@ -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;
index 196215c9d42494b6d2836d27bf939a450c6c6666..9d98382e48c776e6a0d9953f7dfaa1fd8c95aaaf 100644 (file)
@@ -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);