From: Sudha Bheemanna Date: Thu, 8 Sep 2016 05:51:06 +0000 (+0530) Subject: Bluetooth: Set filter policy for LE connection X-Git-Tag: accepted/tizen/unified/riscv/20230725.071352~60 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=66bc368f3c71b616bdd38ae6bbd667e4929a21a4;p=platform%2Fkernel%2Flinux-starfive.git Bluetooth: Set filter policy for LE connection 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 [squash patches, LE connection policy, set dest address and check dest address before cancelling connection] Signed-off-by: Seung-Woo Kim Signed-off-by: Amit Purwar Signed-off-by: Wootak Jung --- diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 3928ba8fb581..1dc9e20cbfe3 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -5995,6 +5995,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); } diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index 3115132ff441..2d51bbfd4d16 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -5148,7 +5148,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) { +#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); if (hdev->hci_ver < BLUETOOTH_VER_1_2) @@ -6094,7 +6098,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);