Diff between a79f778498f257b9dba92a29478ed4b41f3bf670 and 5e7dfbd7d77228ab9fd9ac3ade50be4e676285d4

Changed Files

File Additions Deletions Status
android/bluetooth.c +8 -4 modified

Full Patch

diff --git a/android/bluetooth.c b/android/bluetooth.c
index 2d16858..89212e3 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -1033,12 +1033,10 @@ static void clear_device_found(gpointer data, gpointer user_data)
 
 static uint8_t get_adapter_discovering_type(void)
 {
-	uint8_t type;
+	uint8_t type = SCAN_TYPE_NONE;
 
 	if (adapter.current_settings & MGMT_SETTING_BREDR)
-		type = SCAN_TYPE_BREDR;
-	else
-		type = 0;
+		type |= SCAN_TYPE_BREDR;
 
 	if (adapter.current_settings & MGMT_SETTING_LE)
 		type |= SCAN_TYPE_LE;
@@ -1054,6 +1052,9 @@ static bool start_discovery(uint8_t type)
 
 	DBG("type=0x%x", cp.type);
 
+	if (cp.type == SCAN_TYPE_NONE)
+		return false;
+
 	if (mgmt_send(mgmt_if, MGMT_OP_START_DISCOVERY, adapter.index,
 				sizeof(cp), &cp, NULL, NULL, NULL) > 0)
 		return true;
@@ -2893,6 +2894,9 @@ static bool stop_discovery(uint8_t type)
 
 	DBG("type=0x%x", cp.type);
 
+	if (cp.type == SCAN_TYPE_NONE)
+		return false;
+
 	/* Lets drop all confirm name request as we don't need it anymore */
 	g_slist_foreach(cached_devices, cancel_pending_confirm_name, NULL);