Skip to content
Permalink
Browse files

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 <joakim.andersson@nordicsemi.no>
  • Loading branch information...
joerchan authored and carlescufi committed Aug 5, 2019
1 parent 7f1e67b commit 90706a82171e1d13da1278e4e85810f36e45c0e2
Showing with 9 additions and 7 deletions.
  1. +9 −7 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,

0 comments on commit 90706a8

Please sign in to comment.
You can’t perform that action at this time.