Bluetooth: mgmt: Add legacy pairing info to dev_found events
This patch makes sure that legacy pairing vs SSP infomation gets properly propageted to the device_found events in the form of the legacy pairing flag. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
9a395a80dc
commit
388fc8faf2
@ -407,7 +407,7 @@ struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev,
|
|||||||
void hci_inquiry_cache_update_resolve(struct hci_dev *hdev,
|
void hci_inquiry_cache_update_resolve(struct hci_dev *hdev,
|
||||||
struct inquiry_entry *ie);
|
struct inquiry_entry *ie);
|
||||||
bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
|
bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
|
||||||
bool name_known);
|
bool name_known, bool *ssp);
|
||||||
|
|
||||||
/* ----- HCI Connections ----- */
|
/* ----- HCI Connections ----- */
|
||||||
enum {
|
enum {
|
||||||
@ -1018,7 +1018,8 @@ int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash,
|
|||||||
int mgmt_le_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
|
int mgmt_le_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
|
||||||
int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
|
int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
|
||||||
u8 addr_type, u8 *dev_class, s8 rssi,
|
u8 addr_type, u8 *dev_class, s8 rssi,
|
||||||
u8 cfm_name, u8 *eir, u16 eir_len);
|
u8 cfm_name, u8 ssp, u8 *eir,
|
||||||
|
u16 eir_len);
|
||||||
int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
|
int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
|
||||||
u8 addr_type, s8 rssi, u8 *name, u8 name_len);
|
u8 addr_type, s8 rssi, u8 *name, u8 name_len);
|
||||||
int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status);
|
int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status);
|
||||||
|
@ -466,15 +466,21 @@ void hci_inquiry_cache_update_resolve(struct hci_dev *hdev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
|
bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
|
||||||
bool name_known)
|
bool name_known, bool *ssp)
|
||||||
{
|
{
|
||||||
struct discovery_state *cache = &hdev->discovery;
|
struct discovery_state *cache = &hdev->discovery;
|
||||||
struct inquiry_entry *ie;
|
struct inquiry_entry *ie;
|
||||||
|
|
||||||
BT_DBG("cache %p, %s", cache, batostr(&data->bdaddr));
|
BT_DBG("cache %p, %s", cache, batostr(&data->bdaddr));
|
||||||
|
|
||||||
|
if (ssp)
|
||||||
|
*ssp = data->ssp_mode;
|
||||||
|
|
||||||
ie = hci_inquiry_cache_lookup(hdev, &data->bdaddr);
|
ie = hci_inquiry_cache_lookup(hdev, &data->bdaddr);
|
||||||
if (ie) {
|
if (ie) {
|
||||||
|
if (ie->data.ssp_mode && ssp)
|
||||||
|
*ssp = true;
|
||||||
|
|
||||||
if (ie->name_state == NAME_NEEDED &&
|
if (ie->name_state == NAME_NEEDED &&
|
||||||
data->rssi != ie->data.rssi) {
|
data->rssi != ie->data.rssi) {
|
||||||
ie->data.rssi = data->rssi;
|
ie->data.rssi = data->rssi;
|
||||||
|
@ -1696,7 +1696,7 @@ static inline void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *
|
|||||||
hci_dev_lock(hdev);
|
hci_dev_lock(hdev);
|
||||||
|
|
||||||
for (; num_rsp; num_rsp--, info++) {
|
for (; num_rsp; num_rsp--, info++) {
|
||||||
bool name_known;
|
bool name_known, ssp;
|
||||||
|
|
||||||
bacpy(&data.bdaddr, &info->bdaddr);
|
bacpy(&data.bdaddr, &info->bdaddr);
|
||||||
data.pscan_rep_mode = info->pscan_rep_mode;
|
data.pscan_rep_mode = info->pscan_rep_mode;
|
||||||
@ -1707,9 +1707,9 @@ static inline void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *
|
|||||||
data.rssi = 0x00;
|
data.rssi = 0x00;
|
||||||
data.ssp_mode = 0x00;
|
data.ssp_mode = 0x00;
|
||||||
|
|
||||||
name_known = hci_inquiry_cache_update(hdev, &data, false);
|
name_known = hci_inquiry_cache_update(hdev, &data, false, &ssp);
|
||||||
mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00,
|
mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00,
|
||||||
info->dev_class, 0, !name_known,
|
info->dev_class, 0, !name_known, ssp,
|
||||||
NULL, 0);
|
NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2783,7 +2783,7 @@ static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct
|
|||||||
{
|
{
|
||||||
struct inquiry_data data;
|
struct inquiry_data data;
|
||||||
int num_rsp = *((__u8 *) skb->data);
|
int num_rsp = *((__u8 *) skb->data);
|
||||||
bool name_known;
|
bool name_known, ssp;
|
||||||
|
|
||||||
BT_DBG("%s num_rsp %d", hdev->name, num_rsp);
|
BT_DBG("%s num_rsp %d", hdev->name, num_rsp);
|
||||||
|
|
||||||
@ -2807,10 +2807,10 @@ static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct
|
|||||||
data.ssp_mode = 0x00;
|
data.ssp_mode = 0x00;
|
||||||
|
|
||||||
name_known = hci_inquiry_cache_update(hdev, &data,
|
name_known = hci_inquiry_cache_update(hdev, &data,
|
||||||
false);
|
false, &ssp);
|
||||||
mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00,
|
mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00,
|
||||||
info->dev_class, info->rssi,
|
info->dev_class, info->rssi,
|
||||||
!name_known, NULL, 0);
|
!name_known, ssp, NULL, 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
struct inquiry_info_with_rssi *info = (void *) (skb->data + 1);
|
struct inquiry_info_with_rssi *info = (void *) (skb->data + 1);
|
||||||
@ -2825,10 +2825,10 @@ static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct
|
|||||||
data.rssi = info->rssi;
|
data.rssi = info->rssi;
|
||||||
data.ssp_mode = 0x00;
|
data.ssp_mode = 0x00;
|
||||||
name_known = hci_inquiry_cache_update(hdev, &data,
|
name_known = hci_inquiry_cache_update(hdev, &data,
|
||||||
false);
|
false, &ssp);
|
||||||
mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00,
|
mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00,
|
||||||
info->dev_class, info->rssi,
|
info->dev_class, info->rssi,
|
||||||
!name_known, NULL, 0);
|
!name_known, ssp, NULL, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2964,7 +2964,7 @@ static inline void hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct
|
|||||||
hci_dev_lock(hdev);
|
hci_dev_lock(hdev);
|
||||||
|
|
||||||
for (; num_rsp; num_rsp--, info++) {
|
for (; num_rsp; num_rsp--, info++) {
|
||||||
bool name_known;
|
bool name_known, ssp;
|
||||||
|
|
||||||
bacpy(&data.bdaddr, &info->bdaddr);
|
bacpy(&data.bdaddr, &info->bdaddr);
|
||||||
data.pscan_rep_mode = info->pscan_rep_mode;
|
data.pscan_rep_mode = info->pscan_rep_mode;
|
||||||
@ -2982,10 +2982,11 @@ static inline void hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct
|
|||||||
else
|
else
|
||||||
name_known = true;
|
name_known = true;
|
||||||
|
|
||||||
name_known = hci_inquiry_cache_update(hdev, &data, name_known);
|
name_known = hci_inquiry_cache_update(hdev, &data, name_known,
|
||||||
|
&ssp);
|
||||||
mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00,
|
mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00,
|
||||||
info->dev_class, info->rssi,
|
info->dev_class, info->rssi,
|
||||||
!name_known, info->data,
|
!name_known, ssp, info->data,
|
||||||
sizeof(info->data));
|
sizeof(info->data));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3310,7 +3311,8 @@ static inline void hci_le_adv_report_evt(struct hci_dev *hdev,
|
|||||||
|
|
||||||
rssi = ev->data[ev->length];
|
rssi = ev->data[ev->length];
|
||||||
mgmt_device_found(hdev, &ev->bdaddr, LE_LINK, ev->bdaddr_type,
|
mgmt_device_found(hdev, &ev->bdaddr, LE_LINK, ev->bdaddr_type,
|
||||||
NULL, rssi, 0, ev->data, ev->length);
|
NULL, rssi, 0, 1, ev->data,
|
||||||
|
ev->length);
|
||||||
|
|
||||||
ptr += sizeof(*ev) + ev->length + 1;
|
ptr += sizeof(*ev) + ev->length + 1;
|
||||||
}
|
}
|
||||||
|
@ -3730,7 +3730,7 @@ int mgmt_le_enable_complete(struct hci_dev *hdev, u8 enable, u8 status)
|
|||||||
|
|
||||||
int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
|
int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
|
||||||
u8 addr_type, u8 *dev_class, s8 rssi,
|
u8 addr_type, u8 *dev_class, s8 rssi,
|
||||||
u8 cfm_name, u8 *eir, u16 eir_len)
|
u8 cfm_name, u8 ssp, u8 *eir, u16 eir_len)
|
||||||
{
|
{
|
||||||
char buf[512];
|
char buf[512];
|
||||||
struct mgmt_ev_device_found *ev = (void *) buf;
|
struct mgmt_ev_device_found *ev = (void *) buf;
|
||||||
@ -3747,6 +3747,8 @@ int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
|
|||||||
ev->rssi = rssi;
|
ev->rssi = rssi;
|
||||||
if (cfm_name)
|
if (cfm_name)
|
||||||
ev->flags[0] |= MGMT_DEV_FOUND_CONFIRM_NAME;
|
ev->flags[0] |= MGMT_DEV_FOUND_CONFIRM_NAME;
|
||||||
|
if (!ssp)
|
||||||
|
ev->flags[0] |= MGMT_DEV_FOUND_LEGACY_PAIRING;
|
||||||
|
|
||||||
if (eir_len > 0)
|
if (eir_len > 0)
|
||||||
memcpy(ev->eir, eir, eir_len);
|
memcpy(ev->eir, eir, eir_len);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user