提交 dee58c1e 编写于 作者: J Johan Hedberg 提交者: Marcel Holtmann

Bluetooth: Fix incorrectly setting HCI_CONNECTABLE

Since page scan might be enabled by Add Device we should not implicitly
set connectable whenever something else than Set Connectable changes it.
This patch makes sure that we don't set HCI_CONNECTABLE for these cases
if there are any entries in the white list.
Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
上级 a397407f
...@@ -6076,6 +6076,14 @@ void mgmt_connectable(struct hci_dev *hdev, u8 connectable) ...@@ -6076,6 +6076,14 @@ void mgmt_connectable(struct hci_dev *hdev, u8 connectable)
if (!connectable && mgmt_pending_find(MGMT_OP_SET_POWERED, hdev)) if (!connectable && mgmt_pending_find(MGMT_OP_SET_POWERED, hdev))
return; return;
/* If something else than mgmt changed the page scan state we
* can't differentiate this from a change triggered by adding
* the first element to the whitelist. Therefore, avoid
* incorrectly setting HCI_CONNECTABLE.
*/
if (connectable && !list_empty(&hdev->whitelist))
return;
if (connectable) if (connectable)
changed = !test_and_set_bit(HCI_CONNECTABLE, &hdev->dev_flags); changed = !test_and_set_bit(HCI_CONNECTABLE, &hdev->dev_flags);
else else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册