From 5e7dfbd7d77228ab9fd9ac3ade50be4e676285d4 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Fri, 18 Apr 2014 10:17:54 +0200 Subject: [PATCH] android/bluetooth: Avoid starting/stopping discovery with no type --- android/bluetooth.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/android/bluetooth.c b/android/bluetooth.c index 2d16858c6..89212e389 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); -- 2.47.3