Commit 12aa4f0a authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Johan Hedberg

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: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent 2e84d8db
...@@ -2435,6 +2435,16 @@ int hci_dev_open(__u16 dev) ...@@ -2435,6 +2435,16 @@ int hci_dev_open(__u16 dev)
*/ */
flush_workqueue(hdev->req_workqueue); flush_workqueue(hdev->req_workqueue);
/* For controllers not using the management interface and that
* are brought up using legacy ioctl, set the HCI_PAIRABLE bit
* so that pairing works for them. Once the management interface
* is in use this bit will be cleared again and userspace has
* to explicitly enable it.
*/
if (!test_bit(HCI_USER_CHANNEL, &hdev->dev_flags) &&
!test_bit(HCI_MGMT, &hdev->dev_flags))
set_bit(HCI_PAIRABLE, &hdev->dev_flags);
err = hci_dev_do_open(hdev); err = hci_dev_do_open(hdev);
done: done:
...@@ -2826,9 +2836,6 @@ int hci_get_dev_list(void __user *arg) ...@@ -2826,9 +2836,6 @@ int hci_get_dev_list(void __user *arg)
if (test_bit(HCI_AUTO_OFF, &hdev->dev_flags)) if (test_bit(HCI_AUTO_OFF, &hdev->dev_flags))
flags &= ~BIT(HCI_UP); flags &= ~BIT(HCI_UP);
if (!test_bit(HCI_MGMT, &hdev->dev_flags))
set_bit(HCI_PAIRABLE, &hdev->dev_flags);
(dr + n)->dev_id = hdev->id; (dr + n)->dev_id = hdev->id;
(dr + n)->dev_opt = flags; (dr + n)->dev_opt = flags;
...@@ -2869,9 +2876,6 @@ int hci_get_dev_info(void __user *arg) ...@@ -2869,9 +2876,6 @@ int hci_get_dev_info(void __user *arg)
else else
flags = hdev->flags; flags = hdev->flags;
if (!test_bit(HCI_MGMT, &hdev->dev_flags))
set_bit(HCI_PAIRABLE, &hdev->dev_flags);
strcpy(di.name, hdev->name); strcpy(di.name, hdev->name);
di.bdaddr = hdev->bdaddr; di.bdaddr = hdev->bdaddr;
di.type = (hdev->bus & 0x0f) | ((hdev->dev_type & 0x03) << 4); di.type = (hdev->bus & 0x0f) | ((hdev->dev_type & 0x03) << 4);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment