Skip to content

Commit 323243d

Browse files
MariuszSkamrajhedberg
authored andcommitted
Bluetooth: Add a shell command to disable bondable mode
This adds a shell command for qualification purposes to enable/disable Bonding flag in Authentication Requirements. Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
1 parent 4f74f69 commit 323243d

File tree

1 file changed

+21
-0
lines changed
  • subsys/bluetooth/shell

1 file changed

+21
-0
lines changed

subsys/bluetooth/shell/bt.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,26 @@ static int cmd_security(int argc, char *argv[])
11801180
return 0;
11811181
}
11821182

1183+
static int cmd_bondable(int argc, char *argv[])
1184+
{
1185+
const char *bondable;
1186+
1187+
if (argc < 2) {
1188+
return -EINVAL;
1189+
}
1190+
1191+
bondable = argv[1];
1192+
if (!strcmp(bondable, "on")) {
1193+
bt_set_bondable(true);
1194+
} else if (!strcmp(bondable, "off")) {
1195+
bt_set_bondable(false);
1196+
} else {
1197+
return -EINVAL;
1198+
}
1199+
1200+
return 0;
1201+
}
1202+
11831203
static void auth_passkey_display(struct bt_conn *conn, unsigned int passkey)
11841204
{
11851205
char addr[BT_ADDR_LE_STR_LEN];
@@ -2218,6 +2238,7 @@ static const struct shell_cmd bt_commands[] = {
22182238
{ "clear", cmd_clear },
22192239
#if defined(CONFIG_BT_SMP) || defined(CONFIG_BT_BREDR)
22202240
{ "security", cmd_security, "<security level: 0, 1, 2, 3>" },
2241+
{ "bondable", cmd_bondable, "<bondable: on, off>" },
22212242
{ "auth", cmd_auth,
22222243
"<auth method: all, input, display, yesno, confirm, none>" },
22232244
{ "auth-cancel", cmd_auth_cancel, HELP_NONE },

0 commit comments

Comments
 (0)