summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2024-03-28 17:40:53 -0400
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2024-05-14 10:51:04 -0400
commit2e2515c1ba384ae44f6bf13dd64b9a0a950798c4 (patch)
tree1b7084fe000bd00d07920b8f3755af0b01dc8ae9 /net/bluetooth/hci_core.c
parent7c2cc5b1db509fb6e4a20c182cfbaf94255e4a7c (diff)
downloadlinux-2e2515c1ba384ae44f6bf13dd64b9a0a950798c4.tar.gz
linux-2e2515c1ba384ae44f6bf13dd64b9a0a950798c4.tar.bz2
linux-2e2515c1ba384ae44f6bf13dd64b9a0a950798c4.zip
Bluetooth: hci_event: Set DISCOVERY_FINDING on SCAN_ENABLED
This makes sure that discovery state is properly synchronized otherwise reports may not generate MGMT DeviceFound events as it would be assumed that it was not initiated by a discovery session. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index d35015219c26..34cd05856401 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -149,8 +149,6 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
{
int old_state = hdev->discovery.state;
- BT_DBG("%s state %u -> %u", hdev->name, hdev->discovery.state, state);
-
if (old_state == state)
return;
@@ -166,6 +164,13 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
case DISCOVERY_STARTING:
break;
case DISCOVERY_FINDING:
+ /* If discovery was not started then it was initiated by the
+ * MGMT interface so no MGMT event shall be generated either
+ */
+ if (old_state != DISCOVERY_STARTING) {
+ hdev->discovery.state = old_state;
+ return;
+ }
mgmt_discovering(hdev, 1);
break;
case DISCOVERY_RESOLVING:
@@ -173,6 +178,8 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
case DISCOVERY_STOPPING:
break;
}
+
+ bt_dev_dbg(hdev, "state %u -> %u", old_state, state);
}
void hci_inquiry_cache_flush(struct hci_dev *hdev)