Bluetooth: Add scan_rsp parameter to mgmt_device_found()
In preparation for being able to merge ADV_IND/ADV_SCAN_IND and SCAN_RSP together into a single device found event add a second parameter to the mgmt_device_found function. For now all callers pass NULL as this parameters since we don't yet have storing of the last received advertising report. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
ca5c4be716
commit
5d2e9fadf4
@ -1264,8 +1264,9 @@ void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192,
|
|||||||
u8 *randomizer192, u8 *hash256,
|
u8 *randomizer192, u8 *hash256,
|
||||||
u8 *randomizer256, u8 status);
|
u8 *randomizer256, u8 status);
|
||||||
void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
|
void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
|
||||||
u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name,
|
u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, u8
|
||||||
u8 ssp, u8 *eir, u16 eir_len);
|
ssp, u8 *eir, u16 eir_len, u8 *scan_rsp,
|
||||||
|
u8 scan_rsp_len);
|
||||||
void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
|
void 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);
|
||||||
void mgmt_discovering(struct hci_dev *hdev, u8 discovering);
|
void mgmt_discovering(struct hci_dev *hdev, u8 discovering);
|
||||||
|
@ -1827,7 +1827,7 @@ static void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *skb)
|
|||||||
name_known = hci_inquiry_cache_update(hdev, &data, false, &ssp);
|
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, ssp, NULL,
|
info->dev_class, 0, !name_known, ssp, NULL,
|
||||||
0);
|
0, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
hci_dev_unlock(hdev);
|
hci_dev_unlock(hdev);
|
||||||
@ -3102,7 +3102,7 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev,
|
|||||||
false, &ssp);
|
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, ssp, NULL, 0);
|
!name_known, ssp, NULL, 0, NULL, 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
struct inquiry_info_with_rssi *info = (void *) (skb->data + 1);
|
struct inquiry_info_with_rssi *info = (void *) (skb->data + 1);
|
||||||
@ -3120,7 +3120,7 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev,
|
|||||||
false, &ssp);
|
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, ssp, NULL, 0);
|
!name_known, ssp, NULL, 0, NULL, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3309,7 +3309,7 @@ static void hci_extended_inquiry_result_evt(struct hci_dev *hdev,
|
|||||||
eir_len = eir_get_length(info->data, sizeof(info->data));
|
eir_len = eir_get_length(info->data, sizeof(info->data));
|
||||||
mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00,
|
mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00,
|
||||||
info->dev_class, info->rssi, !name_known,
|
info->dev_class, info->rssi, !name_known,
|
||||||
ssp, info->data, eir_len);
|
ssp, info->data, eir_len, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
hci_dev_unlock(hdev);
|
hci_dev_unlock(hdev);
|
||||||
@ -3972,7 +3972,7 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
mgmt_device_found(hdev, bdaddr, LE_LINK, bdaddr_type, NULL, rssi, 0, 1,
|
mgmt_device_found(hdev, bdaddr, LE_LINK, bdaddr_type, NULL, rssi, 0, 1,
|
||||||
data, len);
|
data, len, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb)
|
static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb)
|
||||||
|
@ -5669,7 +5669,8 @@ void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192,
|
|||||||
|
|
||||||
void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
|
void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
|
||||||
u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, u8
|
u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, u8
|
||||||
ssp, u8 *eir, u16 eir_len)
|
ssp, u8 *eir, u16 eir_len, u8 *scan_rsp,
|
||||||
|
u8 scan_rsp_len)
|
||||||
{
|
{
|
||||||
char buf[512];
|
char buf[512];
|
||||||
struct mgmt_ev_device_found *ev = (void *) buf;
|
struct mgmt_ev_device_found *ev = (void *) buf;
|
||||||
@ -5679,8 +5680,10 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
|
|||||||
if (!hci_discovery_active(hdev))
|
if (!hci_discovery_active(hdev))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Leave 5 bytes for a potential CoD field */
|
/* Make sure that the buffer is big enough. The 5 extra bytes
|
||||||
if (sizeof(*ev) + eir_len + 5 > sizeof(buf))
|
* are for the potential CoD field.
|
||||||
|
*/
|
||||||
|
if (sizeof(*ev) + eir_len + scan_rsp_len + 5 > sizeof(buf))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
@ -5707,8 +5710,11 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
|
|||||||
eir_len = eir_append_data(ev->eir, eir_len, EIR_CLASS_OF_DEV,
|
eir_len = eir_append_data(ev->eir, eir_len, EIR_CLASS_OF_DEV,
|
||||||
dev_class, 3);
|
dev_class, 3);
|
||||||
|
|
||||||
ev->eir_len = cpu_to_le16(eir_len);
|
if (scan_rsp_len > 0)
|
||||||
ev_size = sizeof(*ev) + eir_len;
|
memcpy(ev->eir + eir_len, scan_rsp, scan_rsp_len);
|
||||||
|
|
||||||
|
ev->eir_len = cpu_to_le16(eir_len + scan_rsp_len);
|
||||||
|
ev_size = sizeof(*ev) + eir_len + scan_rsp_len;
|
||||||
|
|
||||||
mgmt_event(MGMT_EV_DEVICE_FOUND, hdev, ev, ev_size, NULL);
|
mgmt_event(MGMT_EV_DEVICE_FOUND, hdev, ev, ev_size, NULL);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user