aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-02-21 13:47:06 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-21 13:51:55 -0500
commited9b5f2fa053adce8dac88a385d2225a8ac5f0b5 (patch)
tree3ef92a2f69d14ba6589e764dcf782f8f06e3db4b
parenta297e97cf7228467a8c5c76216945ccf029ae2a4 (diff)
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: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r--net/bluetooth/mgmt.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 08b867a4d0e6..e8f890d7256a 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2965,8 +2965,6 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable)
2965 bool changed = false; 2965 bool changed = false;
2966 int err = 0; 2966 int err = 0;
2967 2967
2968 mgmt_pending_foreach(MGMT_OP_SET_DISCOVERABLE, hdev, settings_rsp, &match);
2969
2970 if (discoverable) { 2968 if (discoverable) {
2971 if (!test_and_set_bit(HCI_DISCOVERABLE, &hdev->dev_flags)) 2969 if (!test_and_set_bit(HCI_DISCOVERABLE, &hdev->dev_flags))
2972 changed = true; 2970 changed = true;
@@ -2975,6 +2973,9 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable)
2975 changed = true; 2973 changed = true;
2976 } 2974 }
2977 2975
2976 mgmt_pending_foreach(MGMT_OP_SET_DISCOVERABLE, hdev, settings_rsp,
2977 &match);
2978
2978 if (changed) 2979 if (changed)
2979 err = new_settings(hdev, match.sk); 2980 err = new_settings(hdev, match.sk);
2980 2981
@@ -2990,9 +2991,6 @@ int mgmt_connectable(struct hci_dev *hdev, u8 connectable)
2990 bool changed = false; 2991 bool changed = false;
2991 int err = 0; 2992 int err = 0;
2992 2993
2993 mgmt_pending_foreach(MGMT_OP_SET_CONNECTABLE, hdev, settings_rsp,
2994 &match);
2995
2996 if (connectable) { 2994 if (connectable) {
2997 if (!test_and_set_bit(HCI_CONNECTABLE, &hdev->dev_flags)) 2995 if (!test_and_set_bit(HCI_CONNECTABLE, &hdev->dev_flags))
2998 changed = true; 2996 changed = true;
@@ -3001,6 +2999,9 @@ int mgmt_connectable(struct hci_dev *hdev, u8 connectable)
3001 changed = true; 2999 changed = true;
3002 } 3000 }
3003 3001
3002 mgmt_pending_foreach(MGMT_OP_SET_CONNECTABLE, hdev, settings_rsp,
3003 &match);
3004
3004 if (changed) 3005 if (changed)
3005 err = new_settings(hdev, match.sk); 3006 err = new_settings(hdev, match.sk);
3006 3007