Revert "Bluetooth: Fix Set Extended (Scan Response) Data"
This reverts commit 4f5fc3be2c
.
It breaks the abi in a way that is not needed for the Android trees.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I0b07da8f83077b68da09526d25b0e19b6ed28eed
This commit is contained in:
@@ -1773,15 +1773,13 @@ struct hci_cp_ext_adv_set {
|
||||
__u8 max_events;
|
||||
} __packed;
|
||||
|
||||
#define HCI_MAX_EXT_AD_LENGTH 251
|
||||
|
||||
#define HCI_OP_LE_SET_EXT_ADV_DATA 0x2037
|
||||
struct hci_cp_le_set_ext_adv_data {
|
||||
__u8 handle;
|
||||
__u8 operation;
|
||||
__u8 frag_pref;
|
||||
__u8 length;
|
||||
__u8 data[];
|
||||
__u8 data[HCI_MAX_AD_LENGTH];
|
||||
} __packed;
|
||||
|
||||
#define HCI_OP_LE_SET_EXT_SCAN_RSP_DATA 0x2038
|
||||
@@ -1790,7 +1788,7 @@ struct hci_cp_le_set_ext_scan_rsp_data {
|
||||
__u8 operation;
|
||||
__u8 frag_pref;
|
||||
__u8 length;
|
||||
__u8 data[];
|
||||
__u8 data[HCI_MAX_AD_LENGTH];
|
||||
} __packed;
|
||||
|
||||
#define LE_SET_ADV_DATA_OP_COMPLETE 0x03
|
||||
|
@@ -226,9 +226,9 @@ struct adv_info {
|
||||
__u16 remaining_time;
|
||||
__u16 duration;
|
||||
__u16 adv_data_len;
|
||||
__u8 adv_data[HCI_MAX_EXT_AD_LENGTH];
|
||||
__u8 adv_data[HCI_MAX_AD_LENGTH];
|
||||
__u16 scan_rsp_len;
|
||||
__u8 scan_rsp_data[HCI_MAX_EXT_AD_LENGTH];
|
||||
__u8 scan_rsp_data[HCI_MAX_AD_LENGTH];
|
||||
__s8 tx_power;
|
||||
bdaddr_t random_addr;
|
||||
bool rpa_expired;
|
||||
@@ -523,9 +523,9 @@ struct hci_dev {
|
||||
DECLARE_BITMAP(dev_flags, __HCI_NUM_FLAGS);
|
||||
|
||||
__s8 adv_tx_power;
|
||||
__u8 adv_data[HCI_MAX_EXT_AD_LENGTH];
|
||||
__u8 adv_data[HCI_MAX_AD_LENGTH];
|
||||
__u8 adv_data_len;
|
||||
__u8 scan_rsp_data[HCI_MAX_EXT_AD_LENGTH];
|
||||
__u8 scan_rsp_data[HCI_MAX_AD_LENGTH];
|
||||
__u8 scan_rsp_data_len;
|
||||
|
||||
struct list_head adv_instances;
|
||||
|
@@ -1596,33 +1596,30 @@ void __hci_req_update_scan_rsp_data(struct hci_request *req, u8 instance)
|
||||
return;
|
||||
|
||||
if (ext_adv_capable(hdev)) {
|
||||
struct {
|
||||
struct hci_cp_le_set_ext_scan_rsp_data cp;
|
||||
u8 data[HCI_MAX_EXT_AD_LENGTH];
|
||||
} pdu;
|
||||
struct hci_cp_le_set_ext_scan_rsp_data cp;
|
||||
|
||||
memset(&pdu, 0, sizeof(pdu));
|
||||
memset(&cp, 0, sizeof(cp));
|
||||
|
||||
if (instance)
|
||||
len = create_instance_scan_rsp_data(hdev, instance,
|
||||
pdu.data);
|
||||
cp.data);
|
||||
else
|
||||
len = create_default_scan_rsp_data(hdev, pdu.data);
|
||||
len = create_default_scan_rsp_data(hdev, cp.data);
|
||||
|
||||
if (hdev->scan_rsp_data_len == len &&
|
||||
!memcmp(pdu.data, hdev->scan_rsp_data, len))
|
||||
!memcmp(cp.data, hdev->scan_rsp_data, len))
|
||||
return;
|
||||
|
||||
memcpy(hdev->scan_rsp_data, pdu.data, len);
|
||||
memcpy(hdev->scan_rsp_data, cp.data, sizeof(cp.data));
|
||||
hdev->scan_rsp_data_len = len;
|
||||
|
||||
pdu.cp.handle = instance;
|
||||
pdu.cp.length = len;
|
||||
pdu.cp.operation = LE_SET_ADV_DATA_OP_COMPLETE;
|
||||
pdu.cp.frag_pref = LE_SET_ADV_DATA_NO_FRAG;
|
||||
cp.handle = instance;
|
||||
cp.length = len;
|
||||
cp.operation = LE_SET_ADV_DATA_OP_COMPLETE;
|
||||
cp.frag_pref = LE_SET_ADV_DATA_NO_FRAG;
|
||||
|
||||
hci_req_add(req, HCI_OP_LE_SET_EXT_SCAN_RSP_DATA,
|
||||
sizeof(pdu.cp) + len, &pdu.cp);
|
||||
hci_req_add(req, HCI_OP_LE_SET_EXT_SCAN_RSP_DATA, sizeof(cp),
|
||||
&cp);
|
||||
} else {
|
||||
struct hci_cp_le_set_scan_rsp_data cp;
|
||||
|
||||
@@ -1745,30 +1742,26 @@ void __hci_req_update_adv_data(struct hci_request *req, u8 instance)
|
||||
return;
|
||||
|
||||
if (ext_adv_capable(hdev)) {
|
||||
struct {
|
||||
struct hci_cp_le_set_ext_adv_data cp;
|
||||
u8 data[HCI_MAX_EXT_AD_LENGTH];
|
||||
} pdu;
|
||||
struct hci_cp_le_set_ext_adv_data cp;
|
||||
|
||||
memset(&pdu, 0, sizeof(pdu));
|
||||
memset(&cp, 0, sizeof(cp));
|
||||
|
||||
len = create_instance_adv_data(hdev, instance, pdu.data);
|
||||
len = create_instance_adv_data(hdev, instance, cp.data);
|
||||
|
||||
/* There's nothing to do if the data hasn't changed */
|
||||
if (hdev->adv_data_len == len &&
|
||||
memcmp(pdu.data, hdev->adv_data, len) == 0)
|
||||
memcmp(cp.data, hdev->adv_data, len) == 0)
|
||||
return;
|
||||
|
||||
memcpy(hdev->adv_data, pdu.data, len);
|
||||
memcpy(hdev->adv_data, cp.data, sizeof(cp.data));
|
||||
hdev->adv_data_len = len;
|
||||
|
||||
pdu.cp.length = len;
|
||||
pdu.cp.handle = instance;
|
||||
pdu.cp.operation = LE_SET_ADV_DATA_OP_COMPLETE;
|
||||
pdu.cp.frag_pref = LE_SET_ADV_DATA_NO_FRAG;
|
||||
cp.length = len;
|
||||
cp.handle = instance;
|
||||
cp.operation = LE_SET_ADV_DATA_OP_COMPLETE;
|
||||
cp.frag_pref = LE_SET_ADV_DATA_NO_FRAG;
|
||||
|
||||
hci_req_add(req, HCI_OP_LE_SET_EXT_ADV_DATA,
|
||||
sizeof(pdu.cp) + len, &pdu.cp);
|
||||
hci_req_add(req, HCI_OP_LE_SET_EXT_ADV_DATA, sizeof(cp), &cp);
|
||||
} else {
|
||||
struct hci_cp_le_set_adv_data cp;
|
||||
|
||||
|
Reference in New Issue
Block a user