[PATCH] android/gatt: Fix for scan non discoverable devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With this patch Android framework will not be notify with non
discoverable LE devices.
---
 android/gatt.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/android/gatt.c b/android/gatt.c
index a33ce25..e10324e 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -41,6 +41,7 @@
 #include "src/log.h"
 #include "hal-msg.h"
 #include "utils.h"
+#include "src/eir.h"
 #include "src/shared/util.h"
 #include "src/shared/queue.h"
 #include "attrib/gattrib.h"
@@ -710,6 +711,7 @@ static void le_device_found_handler(const bdaddr_t *addr, uint8_t addr_type,
 	uint8_t buf[IPC_MTU];
 	struct hal_ev_gatt_client_scan_result *ev = (void *) buf;
 	char bda[18];
+	struct eir_data e;
 
 	if (!scanning)
 		goto connect;
@@ -717,6 +719,17 @@ static void le_device_found_handler(const bdaddr_t *addr, uint8_t addr_type,
 	ba2str(addr, bda);
 	DBG("LE Device found: %s, rssi: %d, adv_data: %d", bda, rssi, !!eir);
 
+	if (eir_len > 0) {
+		memset(&e, 0 ,sizeof(e));
+		eir_parse(&e, eir, eir_len);
+
+		/* Check if device is discoverable. If not then just try to
+		 * connect
+		 */
+		if (!(e.flags & (EIR_LIM_DISC | EIR_GEN_DISC)))
+			goto connect;
+	}
+
 	bdaddr2android(addr, ev->bda);
 	ev->rssi = rssi;
 	ev->len = eir_len;
-- 
1.8.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux