Skip to content

Commit

Permalink
Bluetooth: Track discovery type
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andre Guedes authored and Johan Hedberg committed Feb 19, 2012
1 parent f39799f commit 4aab14e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/net/bluetooth/hci_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ struct inquiry_entry {
};

struct discovery_state {
int type;
enum {
DISCOVERY_STOPPED,
DISCOVERY_STARTING,
Expand Down
2 changes: 2 additions & 0 deletions net/bluetooth/hci_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4aab14e

Please sign in to comment.