From 90706a82171e1d13da1278e4e85810f36e45c0e2 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Mon, 5 Aug 2019 12:51:47 +0200 Subject: [PATCH] Bluetooth: shell: Handle error code of bt_conn_auth_cb_register Fix issue with registering authentication callback handlers failing without notifying the user of the shell. Signed-off-by: Joakim Andersson --- subsys/bluetooth/shell/bt.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/subsys/bluetooth/shell/bt.c b/subsys/bluetooth/shell/bt.c index 15fa2fc708a..9a59ffc46cb 100644 --- a/subsys/bluetooth/shell/bt.c +++ b/subsys/bluetooth/shell/bt.c @@ -1308,24 +1308,26 @@ static struct bt_conn_auth_cb auth_cb_all = { static int cmd_auth(const struct shell *shell, size_t argc, char *argv[]) { + int err; + if (!strcmp(argv[1], "all")) { - bt_conn_auth_cb_register(&auth_cb_all); + err = bt_conn_auth_cb_register(&auth_cb_all); } else if (!strcmp(argv[1], "input")) { - bt_conn_auth_cb_register(&auth_cb_input); + err = bt_conn_auth_cb_register(&auth_cb_input); } else if (!strcmp(argv[1], "display")) { - bt_conn_auth_cb_register(&auth_cb_display); + err = bt_conn_auth_cb_register(&auth_cb_display); } else if (!strcmp(argv[1], "yesno")) { - bt_conn_auth_cb_register(&auth_cb_display_yes_no); + err = bt_conn_auth_cb_register(&auth_cb_display_yes_no); } else if (!strcmp(argv[1], "confirm")) { - bt_conn_auth_cb_register(&auth_cb_confirm); + err = bt_conn_auth_cb_register(&auth_cb_confirm); } else if (!strcmp(argv[1], "none")) { - bt_conn_auth_cb_register(NULL); + err = bt_conn_auth_cb_register(NULL); } else { shell_help(shell); return SHELL_CMD_HELP_PRINTED; } - return 0; + return err; } static int cmd_auth_cancel(const struct shell *shell,