Bluetooth: Enables filter_policy and adv_type set by user 15/220215/5
authorAmit Purwar <amit.purwar@samsung.com>
Mon, 16 Dec 2019 05:58:59 +0000 (11:28 +0530)
committerAmit Purwar <amit.purwar@samsung.com>
Tue, 17 Dec 2019 06:23:06 +0000 (11:53 +0530)
This patch enables the filter_policy and adv_type in advertisement
set by user on MGMT interface using set_advertising_params API.
Currently filter policy and adv_type does not get applied on slot 0
during ADV enable.

Change-Id: I18b2d5bb1db334f2f008b619503582c5eed29f08
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
net/bluetooth/hci_request.c

index f504f021b7a98dcf7e25a69cb4a83b90d6e2d8eb..29f3a6832b53a93c6c24d4d31456381bb192bdb2 100644 (file)
@@ -841,6 +841,7 @@ void hci_req_add_le_passive_scan(struct hci_request *req)
                    &enable_cp);
 }
 
+#ifndef CONFIG_TIZEN_WIP
 static u8 get_cur_adv_instance_scan_rsp_len(struct hci_dev *hdev)
 {
        u8 instance = hdev->cur_adv_instance;
@@ -859,6 +860,7 @@ static u8 get_cur_adv_instance_scan_rsp_len(struct hci_dev *hdev)
         */
        return adv_instance->scan_rsp_len;
 }
+#endif
 
 void __hci_req_disable_advertising(struct hci_request *req)
 {
@@ -1006,16 +1008,23 @@ void __hci_req_enable_advertising(struct hci_request *req)
        cp.min_interval = cpu_to_le16(hdev->le_adv_min_interval);
        cp.max_interval = cpu_to_le16(hdev->le_adv_max_interval);
 
+#ifdef CONFIG_TIZEN_WIP
+       /* User set the filter_polocy in advertisement on MGMT interface
+        * using set_advertising_params API but filter policy does not work
+        * as it was not set during ADV enable.
+        */
+       cp.filter_policy = hdev->adv_filter_policy;
+       cp.type = hdev->adv_type;
+#else
        if (connectable)
                cp.type = LE_ADV_IND;
        else if (get_cur_adv_instance_scan_rsp_len(hdev))
                cp.type = LE_ADV_SCAN_IND;
        else
                cp.type = LE_ADV_NONCONN_IND;
-
+#endif
        cp.own_address_type = own_addr_type;
        cp.channel_map = hdev->le_adv_channel_map;
-
        hci_req_add(req, HCI_OP_LE_SET_ADV_PARAM, sizeof(cp), &cp);
 
        hci_req_add(req, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable), &enable);