Commit ed9b5f2f authored by Johan Hedberg's avatar Johan Hedberg

Bluetooth: mgmt: Fix connectable/discoverable response values

The connectable/discoverable flags need to be changed before sending the
response since otherwise the settings value will be incorrect.
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent a297e97c
...@@ -2965,8 +2965,6 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable) ...@@ -2965,8 +2965,6 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable)
bool changed = false; bool changed = false;
int err = 0; int err = 0;
mgmt_pending_foreach(MGMT_OP_SET_DISCOVERABLE, hdev, settings_rsp, &match);
if (discoverable) { if (discoverable) {
if (!test_and_set_bit(HCI_DISCOVERABLE, &hdev->dev_flags)) if (!test_and_set_bit(HCI_DISCOVERABLE, &hdev->dev_flags))
changed = true; changed = true;
...@@ -2975,6 +2973,9 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable) ...@@ -2975,6 +2973,9 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable)
changed = true; changed = true;
} }
mgmt_pending_foreach(MGMT_OP_SET_DISCOVERABLE, hdev, settings_rsp,
&match);
if (changed) if (changed)
err = new_settings(hdev, match.sk); err = new_settings(hdev, match.sk);
...@@ -2990,9 +2991,6 @@ int mgmt_connectable(struct hci_dev *hdev, u8 connectable) ...@@ -2990,9 +2991,6 @@ int mgmt_connectable(struct hci_dev *hdev, u8 connectable)
bool changed = false; bool changed = false;
int err = 0; int err = 0;
mgmt_pending_foreach(MGMT_OP_SET_CONNECTABLE, hdev, settings_rsp,
&match);
if (connectable) { if (connectable) {
if (!test_and_set_bit(HCI_CONNECTABLE, &hdev->dev_flags)) if (!test_and_set_bit(HCI_CONNECTABLE, &hdev->dev_flags))
changed = true; changed = true;
...@@ -3001,6 +2999,9 @@ int mgmt_connectable(struct hci_dev *hdev, u8 connectable) ...@@ -3001,6 +2999,9 @@ int mgmt_connectable(struct hci_dev *hdev, u8 connectable)
changed = true; changed = true;
} }
mgmt_pending_foreach(MGMT_OP_SET_CONNECTABLE, hdev, settings_rsp,
&match);
if (changed) if (changed)
err = new_settings(hdev, match.sk); err = new_settings(hdev, match.sk);
......
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