summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_sync.c
diff options
context:
space:
mode:
authorBrian Gix <brian.gix@intel.com>2021-10-28 01:58:49 +0200
committerMarcel Holtmann <marcel@holtmann.org>2021-10-29 16:51:59 +0200
commit2f2eb0c9de2eb69969aaf04feffb69310d3804b2 (patch)
tree955d923a52a9538ebcc481ef7ee8f59e89efd00f /net/bluetooth/hci_sync.c
parentBluetooth: hci_sync: Convert MGMT_OP_GET_CONN_INFO (diff)
downloadlinux-2f2eb0c9de2eb69969aaf04feffb69310d3804b2.tar.xz
linux-2f2eb0c9de2eb69969aaf04feffb69310d3804b2.zip
Bluetooth: hci_sync: Convert MGMT_OP_SET_SECURE_CONN
Synchronous version of MGMT_OP_SET_SECURE_CONN. Signed-off-by: Brian Gix <brian.gix@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_sync.c')
-rw-r--r--net/bluetooth/hci_sync.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index ad819ff4e30d..dc27d6652188 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -2104,13 +2104,27 @@ int hci_update_passive_scan(struct hci_dev *hdev)
return hci_cmd_sync_queue(hdev, update_passive_scan_sync, NULL, NULL);
}
-static int hci_write_sc_support_sync(struct hci_dev *hdev, u8 val)
+int hci_write_sc_support_sync(struct hci_dev *hdev, u8 val)
{
+ int err;
+
if (!bredr_sc_enabled(hdev) || lmp_host_sc_capable(hdev))
return 0;
- return __hci_cmd_sync_status(hdev, HCI_OP_WRITE_SC_SUPPORT,
+ err = __hci_cmd_sync_status(hdev, HCI_OP_WRITE_SC_SUPPORT,
sizeof(val), &val, HCI_CMD_TIMEOUT);
+
+ if (!err) {
+ if (val) {
+ hdev->features[1][0] |= LMP_HOST_SC;
+ hci_dev_set_flag(hdev, HCI_SC_ENABLED);
+ } else {
+ hdev->features[1][0] &= ~LMP_HOST_SC;
+ hci_dev_clear_flag(hdev, HCI_SC_ENABLED);
+ }
+ }
+
+ return err;
}
static int hci_write_ssp_mode_sync(struct hci_dev *hdev, u8 mode)