summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-07-02 21:42:01 +0200
committerMarcel Holtmann <marcel@holtmann.org>2014-07-03 17:42:59 +0200
commit75ce208cc44938195f57c55f81c8e4447dd492fb (patch)
tree16611f77ddf97435c8b3bb36a44b06012e689262 /net/bluetooth/mgmt.c
parentBluetooth: Track number of added devices with HCI_AUTO_CONN_REPORT (diff)
downloadlinux-75ce208cc44938195f57c55f81c8e4447dd492fb.tar.xz
linux-75ce208cc44938195f57c55f81c8e4447dd492fb.zip
Bluetooth: Allow mgmt_device_found events for kernel-side scanning
When the kernel is doing LE scanning because of one or more devices added with action 0x00 through the Add Device command we do want to let mgmt_device_found() to proceed with sending an event. This kind of devices are tracked with hdev->pend_le_reports, so check this value before bailing out from the function. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 325bb8136d2c..0a82f08cd191 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -6472,8 +6472,16 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
struct smp_irk *irk;
size_t ev_size;
- if (!hci_discovery_active(hdev))
- return;
+ /* Don't send events for a non-kernel initiated discovery. With
+ * LE one exception is if we have pend_le_reports > 0 in which
+ * case we're doing passive scanning and want these events.
+ */
+ if (!hci_discovery_active(hdev)) {
+ if (link_type == ACL_LINK)
+ return;
+ if (link_type == LE_LINK && !hdev->pend_le_reports)
+ return;
+ }
/* Make sure that the buffer is big enough. The 5 extra bytes
* are for the potential CoD field.