diff options
-rw-r--r-- | include/net/bluetooth/hci.h | 1 | ||||
-rw-r--r-- | include/net/bluetooth/hci_core.h | 3 | ||||
-rw-r--r-- | net/bluetooth/hci_debugfs.c | 49 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 11 |
4 files changed, 5 insertions, 59 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 884ba004237e..aee16bf5d34f 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -172,7 +172,6 @@ enum { | |||
172 | */ | 172 | */ |
173 | enum { | 173 | enum { |
174 | HCI_DUT_MODE, | 174 | HCI_DUT_MODE, |
175 | HCI_FORCE_SC, | ||
176 | HCI_FORCE_BREDR_SMP, | 175 | HCI_FORCE_BREDR_SMP, |
177 | HCI_FORCE_STATIC_ADDR, | 176 | HCI_FORCE_STATIC_ADDR, |
178 | }; | 177 | }; |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 3e7e5110f298..89f4e3c8a097 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -1017,8 +1017,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn); | |||
1017 | 1017 | ||
1018 | #define hdev_is_powered(hdev) (test_bit(HCI_UP, &hdev->flags) && \ | 1018 | #define hdev_is_powered(hdev) (test_bit(HCI_UP, &hdev->flags) && \ |
1019 | !test_bit(HCI_AUTO_OFF, &hdev->dev_flags)) | 1019 | !test_bit(HCI_AUTO_OFF, &hdev->dev_flags)) |
1020 | #define bredr_sc_enabled(dev) ((lmp_sc_capable(dev) || \ | 1020 | #define bredr_sc_enabled(dev) (lmp_sc_capable(dev) && \ |
1021 | test_bit(HCI_FORCE_SC, &(dev)->dbg_flags)) && \ | ||
1022 | test_bit(HCI_SC_ENABLED, &(dev)->dev_flags)) | 1021 | test_bit(HCI_SC_ENABLED, &(dev)->dev_flags)) |
1023 | 1022 | ||
1024 | /* ----- HCI protocols ----- */ | 1023 | /* ----- HCI protocols ----- */ |
diff --git a/net/bluetooth/hci_debugfs.c b/net/bluetooth/hci_debugfs.c index dc8f994a957b..d72ebc2b11fa 100644 --- a/net/bluetooth/hci_debugfs.c +++ b/net/bluetooth/hci_debugfs.c | |||
@@ -375,52 +375,6 @@ static const struct file_operations sc_only_mode_fops = { | |||
375 | .llseek = default_llseek, | 375 | .llseek = default_llseek, |
376 | }; | 376 | }; |
377 | 377 | ||
378 | static ssize_t force_sc_support_read(struct file *file, char __user *user_buf, | ||
379 | size_t count, loff_t *ppos) | ||
380 | { | ||
381 | struct hci_dev *hdev = file->private_data; | ||
382 | char buf[3]; | ||
383 | |||
384 | buf[0] = test_bit(HCI_FORCE_SC, &hdev->dbg_flags) ? 'Y': 'N'; | ||
385 | buf[1] = '\n'; | ||
386 | buf[2] = '\0'; | ||
387 | return simple_read_from_buffer(user_buf, count, ppos, buf, 2); | ||
388 | } | ||
389 | |||
390 | static ssize_t force_sc_support_write(struct file *file, | ||
391 | const char __user *user_buf, | ||
392 | size_t count, loff_t *ppos) | ||
393 | { | ||
394 | struct hci_dev *hdev = file->private_data; | ||
395 | char buf[32]; | ||
396 | size_t buf_size = min(count, (sizeof(buf)-1)); | ||
397 | bool enable; | ||
398 | |||
399 | if (test_bit(HCI_UP, &hdev->flags)) | ||
400 | return -EBUSY; | ||
401 | |||
402 | if (copy_from_user(buf, user_buf, buf_size)) | ||
403 | return -EFAULT; | ||
404 | |||
405 | buf[buf_size] = '\0'; | ||
406 | if (strtobool(buf, &enable)) | ||
407 | return -EINVAL; | ||
408 | |||
409 | if (enable == test_bit(HCI_FORCE_SC, &hdev->dbg_flags)) | ||
410 | return -EALREADY; | ||
411 | |||
412 | change_bit(HCI_FORCE_SC, &hdev->dbg_flags); | ||
413 | |||
414 | return count; | ||
415 | } | ||
416 | |||
417 | static const struct file_operations force_sc_support_fops = { | ||
418 | .open = simple_open, | ||
419 | .read = force_sc_support_read, | ||
420 | .write = force_sc_support_write, | ||
421 | .llseek = default_llseek, | ||
422 | }; | ||
423 | |||
424 | static int idle_timeout_set(void *data, u64 val) | 378 | static int idle_timeout_set(void *data, u64 val) |
425 | { | 379 | { |
426 | struct hci_dev *hdev = data; | 380 | struct hci_dev *hdev = data; |
@@ -521,9 +475,6 @@ void hci_debugfs_create_bredr(struct hci_dev *hdev) | |||
521 | hdev, &auto_accept_delay_fops); | 475 | hdev, &auto_accept_delay_fops); |
522 | debugfs_create_file("sc_only_mode", 0444, hdev->debugfs, | 476 | debugfs_create_file("sc_only_mode", 0444, hdev->debugfs, |
523 | hdev, &sc_only_mode_fops); | 477 | hdev, &sc_only_mode_fops); |
524 | |||
525 | debugfs_create_file("force_sc_support", 0644, hdev->debugfs, | ||
526 | hdev, &force_sc_support_fops); | ||
527 | } | 478 | } |
528 | 479 | ||
529 | if (lmp_sniff_capable(hdev)) { | 480 | if (lmp_sniff_capable(hdev)) { |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 3d2f7ad1e655..6b3f5537e441 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -570,8 +570,7 @@ static u32 get_supported_settings(struct hci_dev *hdev) | |||
570 | settings |= MGMT_SETTING_HS; | 570 | settings |= MGMT_SETTING_HS; |
571 | } | 571 | } |
572 | 572 | ||
573 | if (lmp_sc_capable(hdev) || | 573 | if (lmp_sc_capable(hdev)) |
574 | test_bit(HCI_FORCE_SC, &hdev->dbg_flags)) | ||
575 | settings |= MGMT_SETTING_SECURE_CONN; | 574 | settings |= MGMT_SETTING_SECURE_CONN; |
576 | } | 575 | } |
577 | 576 | ||
@@ -4727,8 +4726,8 @@ static int set_secure_conn(struct sock *sk, struct hci_dev *hdev, | |||
4727 | 4726 | ||
4728 | BT_DBG("request for %s", hdev->name); | 4727 | BT_DBG("request for %s", hdev->name); |
4729 | 4728 | ||
4730 | if (!test_bit(HCI_LE_ENABLED, &hdev->dev_flags) && | 4729 | if (!lmp_sc_capable(hdev) && |
4731 | !lmp_sc_capable(hdev) && !test_bit(HCI_FORCE_SC, &hdev->dbg_flags)) | 4730 | !test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) |
4732 | return cmd_status(sk, hdev->id, MGMT_OP_SET_SECURE_CONN, | 4731 | return cmd_status(sk, hdev->id, MGMT_OP_SET_SECURE_CONN, |
4733 | MGMT_STATUS_NOT_SUPPORTED); | 4732 | MGMT_STATUS_NOT_SUPPORTED); |
4734 | 4733 | ||
@@ -4738,9 +4737,7 @@ static int set_secure_conn(struct sock *sk, struct hci_dev *hdev, | |||
4738 | 4737 | ||
4739 | hci_dev_lock(hdev); | 4738 | hci_dev_lock(hdev); |
4740 | 4739 | ||
4741 | if (!hdev_is_powered(hdev) || | 4740 | if (!hdev_is_powered(hdev) || !lmp_sc_capable(hdev) || |
4742 | (!lmp_sc_capable(hdev) && | ||
4743 | !test_bit(HCI_FORCE_SC, &hdev->dbg_flags)) || | ||
4744 | !test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags)) { | 4741 | !test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags)) { |
4745 | bool changed; | 4742 | bool changed; |
4746 | 4743 | ||