From: Sudha Bheemanna Date: Thu, 25 Aug 2016 06:11:34 +0000 (+0530) Subject: Bluetooth: Add stop LE auto connection feature X-Git-Tag: accepted/tizen/unified/20250103.010701~32 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0677a06a7a31d2b6627b8b8049a7e70e49fcd415;p=platform%2Fkernel%2Flinux-riscv.git Bluetooth: Add stop LE auto connection feature Added new MGMT command to disable LE auto connection. Change-Id: I78035986217697dadd691e8b50d38a7d75754755 Signed-off-by: Sudha Bheemanna Signed-off-by: Amit Purwar Signed-off-by: Wootak Jung Signed-off-by: Jaehoon Chung --- diff --git a/include/net/bluetooth/mgmt_tizen.h b/include/net/bluetooth/mgmt_tizen.h index 844af75d1fe0..fab5beb876a2 100644 --- a/include/net/bluetooth/mgmt_tizen.h +++ b/include/net/bluetooth/mgmt_tizen.h @@ -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 */ diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index d698560b8cfb..519ae562f352 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -8494,6 +8494,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) @@ -10752,6 +10770,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