Bluetooth: Add stop LE auto connection feature
authorSudha Bheemanna <b.sudha@samsung.com>
Thu, 25 Aug 2016 06:11:34 +0000 (11:41 +0530)
committerJaehoon Chung <jh80.chung@samsung.com>
Tue, 12 Nov 2024 04:03:10 +0000 (13:03 +0900)
Added new MGMT command to disable LE auto connection.

Change-Id: Ifd2dd85ea6368dad76f6753f442ffd94f53fc208
Signed-off-by: Sudha Bheemanna <b.sudha@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>
include/net/bluetooth/mgmt_tizen.h
net/bluetooth/mgmt.c

index 844af75d1fe0c20202e16f0bec31f65a9be5a594..fab5beb876a2dca7f07451657fa9dfa2317da3bd 100644 (file)
@@ -118,6 +118,11 @@ struct mgmt_cp_stop_le_discovery {
 #define MGMT_STOP_LE_DISCOVERY_SIZE            1
 /* le discovery */
 
+/* For LE auto connection */
+#define MGMT_OP_DISABLE_LE_AUTO_CONNECT                (TIZEN_OP_CODE_BASE + 0x0c)
+#define MGMT_DISABLE_LE_AUTO_CONNECT_SIZE      0
+/* LE auto connection */
+
 /* EVENTS */
 
 /* For device name update changes */
index 22680f329eb5414b18bf97fbd48b864da6687cd1..35fe5edf353b6ab2a3bcd268f2830acc40ea8faf 100644 (file)
@@ -8518,6 +8518,24 @@ void mgmt_le_discovering(struct hci_dev *hdev, u8 discovering)
 
        mgmt_event(MGMT_EV_DISCOVERING, hdev, &ev, sizeof(ev), NULL);
 }
+
+static int disable_le_auto_connect(struct sock *sk, struct hci_dev *hdev,
+                       void *data, u16 len)
+{
+       int err;
+
+       BT_DBG("%s", hdev->name);
+
+       hci_dev_lock(hdev);
+
+       err = hci_send_cmd(hdev, HCI_OP_LE_CREATE_CONN_CANCEL, 0, NULL);
+       if (err < 0)
+               BT_ERR("HCI_OP_LE_CREATE_CONN_CANCEL is failed");
+
+       hci_dev_unlock(hdev);
+
+       return err;
+}
 #endif /* TIZEN_BT */
 
 static bool ltk_is_valid(struct mgmt_ltk_info *key)
@@ -10768,6 +10786,7 @@ static const struct hci_mgmt_handler tizen_mgmt_handlers[] = {
        { set_disable_threshold,   MGMT_SET_RSSI_DISABLE_SIZE },
        { start_le_discovery,      MGMT_START_LE_DISCOVERY_SIZE },
        { stop_le_discovery,       MGMT_STOP_LE_DISCOVERY_SIZE },
+       { disable_le_auto_connect, MGMT_DISABLE_LE_AUTO_CONNECT_SIZE },
 };
 #endif