summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-07-09 13:28:26 +0300
committerMarcel Holtmann <marcel@holtmann.org>2014-07-09 12:30:18 +0200
commit91a668b0565dddc9f556f9bce65da58264c74623 (patch)
tree4eb3d06e972db4be177d5c40697cedbba3349906 /net/bluetooth/hci_core.c
parenta55bd29d522729e0cb125474396acdc2a107d4d9 (diff)
downloadop-kernel-dev-91a668b0565dddc9f556f9bce65da58264c74623.zip
op-kernel-dev-91a668b0565dddc9f556f9bce65da58264c74623.tar.gz
Bluetooth: Fix setting HCI_CONNECTABLE from ioctl code
When the white list is in use the code would not update the HCI_CONNECTABLE flag if it gets changed through the ioctl code (e.g. hciconfig hci0 pscan). Since the flag is important for properly accepting incoming connections add code to fix it up if necessary and emit a New Settings mgmt event. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 728a6ee..84431b8 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2715,6 +2715,23 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg)
case HCISETSCAN:
err = hci_req_sync(hdev, hci_scan_req, dr.dev_opt,
HCI_INIT_TIMEOUT);
+
+ /* Ensure that the connectable state gets correctly
+ * notified if the whitelist is in use.
+ */
+ if (!err && !list_empty(&hdev->whitelist)) {
+ bool changed;
+
+ if ((dr.dev_opt & SCAN_PAGE))
+ changed = !test_and_set_bit(HCI_CONNECTABLE,
+ &hdev->dev_flags);
+ else
+ changed = test_and_set_bit(HCI_CONNECTABLE,
+ &hdev->dev_flags);
+
+ if (changed)
+ mgmt_new_settings(hdev);
+ }
break;
case HCISETLINKPOL:
OpenPOWER on IntegriCloud