Diff between 850b9d7c9b04a6a2e0778e68daaace7f2cd13520 and bfce7f800ba55facdca855623e033b63411216fc

Changed Files

File Additions Deletions Status
tools/btmgmt.c +7 -8 modified

Full Patch

diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index c3cbc00..7d8d6d8 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -389,14 +389,15 @@ static void conn_failed(uint16_t index, uint16_t len, const void *param,
 	}
 }
 
-static int mgmt_auth_failed(int mgmt_sk, uint16_t index,
-				struct mgmt_ev_auth_failed *ev,
-				uint16_t len)
+static void auth_failed(uint16_t index, uint16_t len, const void *param,
+							void *user_data)
 {
+	const struct mgmt_ev_auth_failed *ev = param;
+
 	if (len != sizeof(*ev)) {
 		fprintf(stderr,
 			"Invalid auth_failed event length (%u bytes)\n", len);
-		return -EINVAL;
+		return;
 	}
 
 	if (monitor) {
@@ -405,8 +406,6 @@ static int mgmt_auth_failed(int mgmt_sk, uint16_t index,
 		printf("hci%u %s auth failed with status 0x%02x (%s)\n",
 			index, addr, ev->status, mgmt_errstr(ev->status));
 	}
-
-	return 0;
 }
 
 static int mgmt_name_changed(int mgmt_sk, uint16_t index,
@@ -715,8 +714,6 @@ static int mgmt_handle_event(int mgmt_sk, uint16_t ev, uint16_t index,
 		return mgmt_cmd_complete(mgmt_sk, index, data, len);
 	case MGMT_EV_CMD_STATUS:
 		return mgmt_cmd_status(mgmt_sk, index, data, len);
-	case MGMT_EV_AUTH_FAILED:
-		return mgmt_auth_failed(mgmt_sk, index, data, len);
 	case MGMT_EV_LOCAL_NAME_CHANGED:
 		return mgmt_name_changed(mgmt_sk, index, data, len);
 	case MGMT_EV_DEVICE_FOUND:
@@ -2048,6 +2045,8 @@ int main(int argc, char *argv[])
 								NULL, NULL);
 	mgmt_register(mgmt, MGMT_EV_CONNECT_FAILED, index, conn_failed,
 								NULL, NULL);
+	mgmt_register(mgmt, MGMT_EV_AUTH_FAILED, index, auth_failed,
+								NULL, NULL);
 
 	event_loop = g_main_loop_new(NULL, FALSE);
 	mgmt_io = g_io_channel_unix_new(mgmt_sk);