Skip to content

Fix bluetooth shell issue #90065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions subsys/bluetooth/host/shell/bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -826,17 +826,23 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
bt_shell_print("Disconnected: %s (reason 0x%02x)", addr, reason);

if (default_conn == conn) {
enum bt_conn_type conn_type = BT_CONN_TYPE_LE;

if (IS_ENABLED(CONFIG_BT_CLASSIC)) {
conn_type |= BT_CONN_TYPE_BR;
}

bt_conn_unref(default_conn);
default_conn = NULL;

/* If we are connected to other devices, set one of them as default */
bt_conn_foreach(BT_CONN_TYPE_LE, disconnected_set_new_default_conn_cb, NULL);
bt_conn_foreach(conn_type, disconnected_set_new_default_conn_cb, NULL);
}
}

static bool le_param_req(struct bt_conn *conn, struct bt_le_conn_param *param)
{
bt_shell_print("LE conn param req: int (0x%04x, 0x%04x) lat %d to %d",
bt_shell_print("LE conn param req: int (0x%04x, 0x%04x) lat %d to %d",
param->interval_min, param->interval_max,
param->latency, param->timeout);

Expand Down Expand Up @@ -3847,7 +3853,7 @@ static int cmd_security(const struct shell *sh, size_t argc, char *argv[])
sec = *argv[1] - '0';

if ((info.type == BT_CONN_TYPE_BR &&
(sec < BT_SECURITY_L0 || sec > BT_SECURITY_L3))) {
(sec < BT_SECURITY_L0 || sec > BT_SECURITY_L4))) {
shell_error(sh, "Invalid BR/EDR security level (%d)", sec);
return -ENOEXEC;
}
Expand Down Expand Up @@ -5121,7 +5127,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds,
SHELL_CMD_ARG(oob, NULL, HELP_NONE, cmd_oob, 1, 0),
SHELL_CMD_ARG(clear, NULL, "[all] ["HELP_ADDR_LE"]", cmd_clear, 2, 1),
#if defined(CONFIG_BT_SMP) || defined(CONFIG_BT_CLASSIC)
SHELL_CMD_ARG(security, NULL, "<security level BR/EDR: 0 - 3, "
SHELL_CMD_ARG(security, NULL, "<security level BR/EDR: 0 - 4, "
"LE: 1 - 4> [force-pair]",
cmd_security, 1, 2),
SHELL_CMD_ARG(bondable, NULL, HELP_ONOFF, cmd_bondable,
Expand Down