Diff between e88d1f041fa84836d46c39748461de84d51c1226 and 6f94a3838a888a07003ddfa5c859b64fc4373ffe

Changed Files

File Additions Deletions Status
src/event.c +0 -24 modified
src/event.h +0 -2 modified
src/mgmt.c +16 -2 modified

Full Patch

diff --git a/src/event.c b/src/event.c
index 29931a3..783deb5 100644
--- a/src/event.c
+++ b/src/event.c
@@ -276,30 +276,6 @@ int btd_event_ltk_notify(bdaddr_t *local, bdaddr_t *peer, uint8_t bdaddr_type,
 	return 0;
 }
 
-void btd_event_device_blocked(bdaddr_t *local, bdaddr_t *peer)
-{
-	struct btd_adapter *adapter;
-	struct btd_device *device;
-
-	if (!get_adapter_and_device(local, peer, &adapter, &device, FALSE))
-		return;
-
-	if (device)
-		device_block(device, TRUE);
-}
-
-void btd_event_device_unblocked(bdaddr_t *local, bdaddr_t *peer)
-{
-	struct btd_adapter *adapter;
-	struct btd_device *device;
-
-	if (!get_adapter_and_device(local, peer, &adapter, &device, FALSE))
-		return;
-
-	if (device)
-		device_unblock(device, FALSE, TRUE);
-}
-
 void btd_event_device_unpaired(bdaddr_t *local, bdaddr_t *peer)
 {
 	struct btd_adapter *adapter;
diff --git a/src/event.h b/src/event.h
index ddaa24e..4874217 100644
--- a/src/event.h
+++ b/src/event.h
@@ -25,8 +25,6 @@
 void btd_event_remote_name(const bdaddr_t *local, bdaddr_t *peer,
 							const char *name);
 void btd_event_returned_link_key(bdaddr_t *local, bdaddr_t *peer);
-void btd_event_device_blocked(bdaddr_t *local, bdaddr_t *peer);
-void btd_event_device_unblocked(bdaddr_t *local, bdaddr_t *peer);
 void btd_event_device_unpaired(bdaddr_t *local, bdaddr_t *peer);
 int btd_event_link_key_notify(bdaddr_t *local, bdaddr_t *peer, uint8_t *key,
 					uint8_t key_type, uint8_t pin_length);
diff --git a/src/mgmt.c b/src/mgmt.c
index c32e756..961cab9 100644
--- a/src/mgmt.c
+++ b/src/mgmt.c
@@ -1798,6 +1798,8 @@ static void mgmt_discovering(int sk, uint16_t index, void *buf, size_t len)
 static void mgmt_device_blocked(int sk, uint16_t index, void *buf, size_t len)
 {
 	struct controller_info *info;
+	struct btd_adapter *adapter;
+	struct btd_device *device;
 	struct mgmt_ev_device_blocked *ev = buf;
 	char addr[18];
 
@@ -1816,12 +1818,19 @@ static void mgmt_device_blocked(int sk, uint16_t index, void *buf, size_t len)
 
 	info = &controllers[index];
 
-	btd_event_device_blocked(&info->bdaddr, &ev->addr.bdaddr);
+	if (!get_adapter_and_device(&info->bdaddr, &ev->addr.bdaddr,
+						&adapter, &device, false))
+		return;
+
+	if (device)
+		device_block(device, TRUE);
 }
 
 static void mgmt_device_unblocked(int sk, uint16_t index, void *buf, size_t len)
 {
 	struct controller_info *info;
+	struct btd_adapter *adapter;
+	struct btd_device *device;
 	struct mgmt_ev_device_unblocked *ev = buf;
 	char addr[18];
 
@@ -1840,7 +1849,12 @@ static void mgmt_device_unblocked(int sk, uint16_t index, void *buf, size_t len)
 
 	info = &controllers[index];
 
-	btd_event_device_unblocked(&info->bdaddr, &ev->addr.bdaddr);
+	if (!get_adapter_and_device(&info->bdaddr, &ev->addr.bdaddr,
+						&adapter, &device, false))
+		return;
+
+	if (device)
+		device_unblock(device, FALSE, TRUE);
 }
 
 static void mgmt_device_unpaired(int sk, uint16_t index, void *buf, size_t len)