aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-01-04 15:44:20 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-13 17:01:20 +0200
commit30dc78e1a2bcbe2a0fca7aa44dfded4bb0db6148 (patch)
treee84a8d690192e75d14212d690e772575eebf68e8 /net/bluetooth/hci_core.c
parentBluetooth: Add discovery state tracking (diff)
downloadlinux-dev-30dc78e1a2bcbe2a0fca7aa44dfded4bb0db6148.tar.xz
linux-dev-30dc78e1a2bcbe2a0fca7aa44dfded4bb0db6148.zip
Bluetooth: Add name resolving support for mgmt based discovery
This patch adds the necessary logic to perform name lookups after inquiry completes. This is done by checking for entries in the resolve list after each inquiry complete and remote name complete HCI event. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index b68719230601..546a42941477 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -356,6 +356,17 @@ struct hci_dev *hci_dev_get(int index)
/* ---- Inquiry support ---- */
+bool hci_discovery_active(struct hci_dev *hdev)
+{
+ struct discovery_state *discov = &hdev->discovery;
+
+ if (discov->state == DISCOVERY_INQUIRY ||
+ discov->state == DISCOVERY_RESOLVING)
+ return true;
+
+ return false;
+}
+
void hci_discovery_set_state(struct hci_dev *hdev, int state)
{
BT_DBG("%s state %u -> %u", hdev->name, hdev->discovery.state, state);
@@ -369,9 +380,11 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
break;
case DISCOVERY_STARTING:
break;
- case DISCOVERY_ACTIVE:
+ case DISCOVERY_INQUIRY:
mgmt_discovering(hdev, 1);
break;
+ case DISCOVERY_RESOLVING:
+ break;
case DISCOVERY_STOPPING:
break;
}
@@ -425,6 +438,25 @@ struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev,
return NULL;
}
+struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev,
+ bdaddr_t *bdaddr,
+ int state)
+{
+ struct discovery_state *cache = &hdev->discovery;
+ struct inquiry_entry *e;
+
+ BT_DBG("cache %p bdaddr %s state %d", cache, batostr(bdaddr), state);
+
+ list_for_each_entry(e, &cache->resolve, list) {
+ if (!bacmp(bdaddr, BDADDR_ANY) && e->name_state == state)
+ return e;
+ if (!bacmp(&e->data.bdaddr, bdaddr))
+ return e;
+ }
+
+ return NULL;
+}
+
bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
bool name_known)
{