Bluetooth: Set filter policy for LE connection 28/317428/1
authorSudha Bheemanna <b.sudha@samsung.com>
Thu, 8 Sep 2016 05:51:06 +0000 (11:21 +0530)
committerJaehoon Chung <jh80.chung@samsung.com>
Thu, 2 Jan 2025 06:08:57 +0000 (15:08 +0900)
This patch sets the filter policy to a default value 0x01 during
LE auto connection if the destination address is not set. And it
updates the destination address once the LE connection complete
event is recieved during LE auto connection. And for it checks
valid destination address before cancelling LE connection when
connection timeout occurs.

Signed-off-by: Sudha Bheemanna <b.sudha@samsung.com>
[squash patches, LE connection policy, set dest address and check dest address before cancelling connection]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I288d4e323e3c39fcef5215b071c7e55af9638702

net/bluetooth/hci_event.c
net/bluetooth/hci_sync.c

index 1e4a886a9d02d92a18558081a241e9d239c777ac..a76e5bfbd7baf590170773d7df8d5b5d0d4e3fb3 100644 (file)
@@ -5827,6 +5827,10 @@ static void le_conn_complete_evt(struct hci_dev *hdev, u8 status,
                        }
                }
        } else {
+#ifdef TIZEN_BT
+               /* LE auto connect */
+               bacpy(&conn->dst, bdaddr);
+#endif
                cancel_delayed_work(&conn->le_conn_timeout);
        }
 
index 815e69f6cce8b3055b416b4276c0dd3ce18ccd20..a168ea6b9d6387d55f723066948fb972772cd261 100644 (file)
@@ -5271,7 +5271,11 @@ static int hci_le_connect_cancel_sync(struct hci_dev *hdev,
 static int hci_connect_cancel_sync(struct hci_dev *hdev, struct hci_conn *conn,
                                   u8 reason)
 {
+#ifdef TIZEN_BT
+       if (conn->type == LE_LINK && bacmp(&conn->dst, BDADDR_ANY))
+#else
        if (conn->type == LE_LINK)
+#endif
                return hci_le_connect_cancel_sync(hdev, conn, reason);
 
        if (conn->type == ISO_LINK) {
@@ -6299,7 +6303,15 @@ int hci_le_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn)
        cp.scan_interval = cpu_to_le16(hdev->le_scan_int_connect);
        cp.scan_window = cpu_to_le16(hdev->le_scan_window_connect);
 
+#ifdef TIZEN_BT
+       /* LE auto connect */
+       if (!bacmp(&conn->dst, BDADDR_ANY))
+               cp.filter_policy = 0x1;
+       else
+               bacpy(&cp.peer_addr, &conn->dst);
+#else
        bacpy(&cp.peer_addr, &conn->dst);
+#endif
        cp.peer_addr_type = conn->dst_type;
        cp.own_address_type = own_addr_type;
        cp.conn_interval_min = cpu_to_le16(conn->le_conn_min_interval);