Diff between bd3f985532ba2a6152c403db2ec7e599676e3cc5 and c7528eb3934db16f18da340877693d70be117a9c

Changed Files

File Additions Deletions Status
android/bluetooth.c +28 -0 modified
android/bluetooth.h +2 -0 modified

Full Patch

diff --git a/android/bluetooth.c b/android/bluetooth.c
index a4a77c8..34690b7 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -1527,6 +1527,34 @@ bool bt_auto_connect_add(const bdaddr_t *addr)
 	return false;
 }
 
+void bt_auto_connect_remove(const bdaddr_t *addr)
+{
+	struct mgmt_cp_remove_device cp;
+	struct device *dev;
+
+	if (!kernel_conn_control)
+		return;
+
+	dev = find_device(addr);
+	if (!dev)
+		return;
+
+	if (dev->bdaddr_type == BDADDR_BREDR) {
+		DBG("auto-connection feature is not available for BR/EDR");
+		return;
+	}
+
+	memset(&cp, 0, sizeof(cp));
+	bacpy(&cp.addr.bdaddr, addr);
+	cp.addr.type = dev->bdaddr_type;
+
+	if (mgmt_send(mgmt_if, MGMT_OP_REMOVE_DEVICE, adapter.index,
+					sizeof(cp), &cp, NULL, NULL, NULL) > 0)
+		return;
+
+	error("Failed to remove device");
+}
+
 static bool rssi_above_threshold(int old, int new)
 {
 	/* only 8 dBm or more */
diff --git a/android/bluetooth.h b/android/bluetooth.h
index 4a7063d..ac7f3ad 100644
--- a/android/bluetooth.h
+++ b/android/bluetooth.h
@@ -83,3 +83,5 @@ const bdaddr_t *bt_get_id_addr(const bdaddr_t *addr, uint8_t *type);
 bool bt_kernel_conn_control(void);
 
 bool bt_auto_connect_add(const bdaddr_t *addr);
+
+void bt_auto_connect_remove(const bdaddr_t *addr);