Diff between 2e7c44eaf60a11eb6e8586e8c07a0541d248c798 and eb106d4727b3b1bce126d9d3193aedd4b4c9ebf7

Changed Files

File Additions Deletions Status
src/event.c +0 -20 modified
src/event.h +0 -3 modified
src/mgmt.c +16 -4 modified

Full Patch

diff --git a/src/event.c b/src/event.c
index 8b41a12..545e991 100644
--- a/src/event.c
+++ b/src/event.c
@@ -276,26 +276,6 @@ int btd_event_ltk_notify(bdaddr_t *local, bdaddr_t *peer, uint8_t bdaddr_type,
 	return 0;
 }
 
-void btd_event_conn_complete(bdaddr_t *local, bdaddr_t *peer, uint8_t bdaddr_type,
-						const char *name, uint32_t class)
-{
-	struct btd_adapter *adapter;
-	struct btd_device *device;
-
-	if (!get_adapter_and_device(local, peer, &adapter, &device, TRUE))
-		return;
-
-	if (class != 0)
-		device_set_class(device, class);
-
-	device_set_addr_type(device, bdaddr_type);
-
-	adapter_add_connection(adapter, device);
-
-	if (name != NULL)
-		btd_event_remote_name(local, peer, name);
-}
-
 void btd_event_conn_failed(bdaddr_t *local, bdaddr_t *peer, uint8_t status)
 {
 	struct btd_adapter *adapter;
diff --git a/src/event.h b/src/event.h
index 1381c94..41ec202 100644
--- a/src/event.h
+++ b/src/event.h
@@ -24,9 +24,6 @@
 
 void btd_event_remote_name(const bdaddr_t *local, bdaddr_t *peer,
 							const char *name);
-void btd_event_conn_complete(bdaddr_t *local, bdaddr_t *peer,
-					uint8_t bdaddr_type, const char *name,
-					uint32_t class);
 void btd_event_conn_failed(bdaddr_t *local, bdaddr_t *peer, uint8_t status);
 void btd_event_disconn_complete(bdaddr_t *local, bdaddr_t *peer);
 void btd_event_returned_link_key(bdaddr_t *local, bdaddr_t *peer);
diff --git a/src/mgmt.c b/src/mgmt.c
index e0bc808..e55f28e 100644
--- a/src/mgmt.c
+++ b/src/mgmt.c
@@ -495,6 +495,8 @@ static void mgmt_device_connected(int sk, uint16_t index, void *buf, size_t len)
 	struct mgmt_ev_device_connected *ev = buf;
 	struct eir_data eir_data;
 	struct controller_info *info;
+	struct btd_adapter *adapter;
+	struct btd_device *device;
 	uint16_t eir_len;
 	char addr[18];
 
@@ -520,14 +522,24 @@ static void mgmt_device_connected(int sk, uint16_t index, void *buf, size_t len)
 
 	info = &controllers[index];
 
+	if (!get_adapter_and_device(&info->bdaddr, &ev->addr.bdaddr,
+						&adapter, &device, true))
+		return;
+
 	memset(&eir_data, 0, sizeof(eir_data));
 	if (eir_len > 0)
 		eir_parse(&eir_data, ev->eir, eir_len);
 
-	btd_event_conn_complete(&info->bdaddr, &ev->addr.bdaddr,
-						ev->addr.type,
-						eir_data.name,
-						eir_data.class);
+	if (eir_data.class != 0)
+		device_set_class(device, eir_data.class);
+
+	device_set_addr_type(device, ev->addr.type);
+
+	adapter_add_connection(adapter, device);
+
+	if (eir_data.name != NULL)
+		btd_event_remote_name(&info->bdaddr, &ev->addr.bdaddr,
+								eir_data.name);
 
 	eir_data_free(&eir_data);
 }