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>
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user