Skip to content

Commit 12aa4f0

Browse files
holtmannjhedberg
authored andcommitted
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>
1 parent 2e84d8d commit 12aa4f0

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎net/bluetooth/hci_core.c‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2435,6 +2435,16 @@ int hci_dev_open(__u16 dev)
24352435
*/
24362436
flush_workqueue(hdev->req_workqueue);
24372437

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+
24382448
err = hci_dev_do_open(hdev);
24392449

24402450
done:
@@ -2826,9 +2836,6 @@ int hci_get_dev_list(void __user *arg)
28262836
if (test_bit(HCI_AUTO_OFF, &hdev->dev_flags))
28272837
flags &= ~BIT(HCI_UP);
28282838

2829-
if (!test_bit(HCI_MGMT, &hdev->dev_flags))
2830-
set_bit(HCI_PAIRABLE, &hdev->dev_flags);
2831-
28322839
(dr + n)->dev_id = hdev->id;
28332840
(dr + n)->dev_opt = flags;
28342841

@@ -2869,9 +2876,6 @@ int hci_get_dev_info(void __user *arg)
28692876
else
28702877
flags = hdev->flags;
28712878

2872-
if (!test_bit(HCI_MGMT, &hdev->dev_flags))
2873-
set_bit(HCI_PAIRABLE, &hdev->dev_flags);
2874-
28752879
strcpy(di.name, hdev->name);
28762880
di.bdaddr = hdev->bdaddr;
28772881
di.type = (hdev->bus & 0x0f) | ((hdev->dev_type & 0x03) << 4);

0 commit comments

Comments
 (0)