aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2014-07-10 09:25:22 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2014-07-10 09:37:18 -0400
commit12aa4f0a3d0576c554efc770a6e16c8bb897b966 (patch)
treeb0e9adbec57472507b2087f3cb6fde226df34948
parent2e84d8db91e45964c2b54ccc7da1f9b4bfb1222b (diff)
Bluetooth: Set HCI_PAIRABLE during power on for legacy ioctl
When the controller is brought up using legacy ioctl, the setting of the HCI_PAIRABLE flag should happen then. Previously it was set during enumeration and when retrieving device information. This change also will not set the HCI_PAIRABLE flag when the controller is used with the HCI User Channel operation. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r--net/bluetooth/hci_core.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 96e0acc3fc92..52e8c91ea3e9 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2435,6 +2435,16 @@ int hci_dev_open(__u16 dev)
2435 */ 2435 */
2436 flush_workqueue(hdev->req_workqueue); 2436 flush_workqueue(hdev->req_workqueue);
2437 2437
2438 /* For controllers not using the management interface and that
2439 * are brought up using legacy ioctl, set the HCI_PAIRABLE bit
2440 * so that pairing works for them. Once the management interface
2441 * is in use this bit will be cleared again and userspace has
2442 * to explicitly enable it.
2443 */
2444 if (!test_bit(HCI_USER_CHANNEL, &hdev->dev_flags) &&
2445 !test_bit(HCI_MGMT, &hdev->dev_flags))
2446 set_bit(HCI_PAIRABLE, &hdev->dev_flags);
2447
2438 err = hci_dev_do_open(hdev); 2448 err = hci_dev_do_open(hdev);
2439 2449
2440done: 2450done:
@@ -2826,9 +2836,6 @@ int hci_get_dev_list(void __user *arg)
2826 if (test_bit(HCI_AUTO_OFF, &hdev->dev_flags)) 2836 if (test_bit(HCI_AUTO_OFF, &hdev->dev_flags))
2827 flags &= ~BIT(HCI_UP); 2837 flags &= ~BIT(HCI_UP);
2828 2838
2829 if (!test_bit(HCI_MGMT, &hdev->dev_flags))
2830 set_bit(HCI_PAIRABLE, &hdev->dev_flags);
2831
2832 (dr + n)->dev_id = hdev->id; 2839 (dr + n)->dev_id = hdev->id;
2833 (dr + n)->dev_opt = flags; 2840 (dr + n)->dev_opt = flags;
2834 2841
@@ -2869,9 +2876,6 @@ int hci_get_dev_info(void __user *arg)
2869 else 2876 else
2870 flags = hdev->flags; 2877 flags = hdev->flags;
2871 2878
2872 if (!test_bit(HCI_MGMT, &hdev->dev_flags))
2873 set_bit(HCI_PAIRABLE, &hdev->dev_flags);
2874
2875 strcpy(di.name, hdev->name); 2879 strcpy(di.name, hdev->name);
2876 di.bdaddr = hdev->bdaddr; 2880 di.bdaddr = hdev->bdaddr;
2877 di.type = (hdev->bus & 0x0f) | ((hdev->dev_type & 0x03) << 4); 2881 di.type = (hdev->bus & 0x0f) | ((hdev->dev_type & 0x03) << 4);