Bluetooth: Enable inquiry and page scan
authorSudha Bheemanna <b.sudha@samsung.com>
Thu, 8 Sep 2016 09:24:54 +0000 (14:54 +0530)
committerHoegeun Kwon <hoegeun.kwon@samsung.com>
Thu, 3 Aug 2023 08:43:16 +0000 (17:43 +0900)
This patch enables the inquiry and page scan after ACL
disconnection with one device and if there are no other
devices connected.

Change-Id: Ifb28be7d23f237d35112b2e0739ed55169baacf7
Signed-off-by: Sudha Bheemanna <b.sudha@samsung.com>
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
net/bluetooth/hci_event.c

index 517901f..3231dff 100644 (file)
@@ -3128,6 +3128,22 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
 
        hci_conn_del(conn);
 
+#ifdef TIZEN_BT
+       if (type == ACL_LINK && !hci_conn_num(hdev, ACL_LINK)) {
+               int iscan;
+               int pscan;
+
+               iscan = test_bit(HCI_ISCAN, &hdev->flags);
+               pscan = test_bit(HCI_PSCAN, &hdev->flags);
+               if (!iscan && !pscan) {
+                       u8 scan_enable = SCAN_PAGE;
+
+                       hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE,
+                                    sizeof(scan_enable), &scan_enable);
+               }
+       }
+#endif
+
 unlock:
        hci_dev_unlock(hdev);
 }