Bluetooth: Set filter policy for LE connection 59/87459/7
authorSudha Bheemanna <b.sudha@samsung.com>
Thu, 8 Sep 2016 05:51:06 +0000 (11:21 +0530)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 29 Sep 2016 05:14:51 +0000 (14:14 +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.

Change-Id: I9877556c0b0ab4826f5f4934ead4d85b7837036d
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>
net/bluetooth/hci_conn.c
net/bluetooth/hci_event.c

index 0a6ac44f5cfec6cf032cd10add3d8e39e908ce4f..24a1965b1d230e367b1ee1c47059abfde9bf4a73 100644 (file)
@@ -359,7 +359,12 @@ static void hci_conn_timeout(struct work_struct *work)
                if (conn->out) {
                        if (conn->type == ACL_LINK)
                                hci_acl_create_connection_cancel(conn);
+#ifdef TIZEN_BT
+                       else if (conn->type == LE_LINK &&
+                                       bacmp(&conn->dst, BDADDR_ANY))
+#else
                        else if (conn->type == LE_LINK)
+#endif
                                hci_le_create_connection_cancel(conn);
                } else if (conn->type == SCO_LINK || conn->type == ESCO_LINK) {
                        hci_reject_sco(conn);
@@ -691,7 +696,15 @@ static void hci_req_add_le_create_conn(struct hci_request *req,
 
        cp.scan_interval = cpu_to_le16(hdev->le_scan_interval);
        cp.scan_window = cpu_to_le16(hdev->le_scan_window);
+#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);
index 697a140b43028a74a10c39cc3be58d5b11070589..1a63bceb8c692e2254481d2a2a241974790507fe 100644 (file)
@@ -4637,6 +4637,10 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
                        }
                }
        } else {
+#ifdef TIZEN_BT
+               /* LE auto connect */
+               bacpy(&conn->dst, &ev->bdaddr);
+#endif
                cancel_delayed_work(&conn->le_conn_timeout);
        }