mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									7c2cc5b1db
								
							
						
					
					
						commit
						2e2515c1ba
					
				
					 2 changed files with 10 additions and 4 deletions
				
			
		| 
						 | 
					@ -149,8 +149,6 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int old_state = hdev->discovery.state;
 | 
						int old_state = hdev->discovery.state;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	BT_DBG("%s state %u -> %u", hdev->name, hdev->discovery.state, state);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (old_state == state)
 | 
						if (old_state == state)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -166,6 +164,13 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
 | 
				
			||||||
	case DISCOVERY_STARTING:
 | 
						case DISCOVERY_STARTING:
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case DISCOVERY_FINDING:
 | 
						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);
 | 
							mgmt_discovering(hdev, 1);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case DISCOVERY_RESOLVING:
 | 
						case DISCOVERY_RESOLVING:
 | 
				
			||||||
| 
						 | 
					@ -173,6 +178,8 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
 | 
				
			||||||
	case DISCOVERY_STOPPING:
 | 
						case DISCOVERY_STOPPING:
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						bt_dev_dbg(hdev, "state %u -> %u", old_state, state);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void hci_inquiry_cache_flush(struct hci_dev *hdev)
 | 
					void hci_inquiry_cache_flush(struct hci_dev *hdev)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1779,7 +1779,6 @@ static void le_set_scan_enable_complete(struct hci_dev *hdev, u8 enable)
 | 
				
			||||||
		hci_dev_set_flag(hdev, HCI_LE_SCAN);
 | 
							hci_dev_set_flag(hdev, HCI_LE_SCAN);
 | 
				
			||||||
		if (hdev->le_scan_type == LE_SCAN_ACTIVE)
 | 
							if (hdev->le_scan_type == LE_SCAN_ACTIVE)
 | 
				
			||||||
			clear_pending_adv_report(hdev);
 | 
								clear_pending_adv_report(hdev);
 | 
				
			||||||
		if (hci_dev_test_flag(hdev, HCI_MESH))
 | 
					 | 
				
			||||||
		hci_discovery_set_state(hdev, DISCOVERY_FINDING);
 | 
							hci_discovery_set_state(hdev, DISCOVERY_FINDING);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue