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>
This commit is contained in:
Mariusz Skamra 2018-09-18 09:44:57 +02:00 committed by Johan Hedberg
commit 323243d376

View file

@ -1180,6 +1180,26 @@ static int cmd_security(int argc, char *argv[])
return 0;
}
static int cmd_bondable(int argc, char *argv[])
{
const char *bondable;
if (argc < 2) {
return -EINVAL;
}
bondable = argv[1];
if (!strcmp(bondable, "on")) {
bt_set_bondable(true);
} else if (!strcmp(bondable, "off")) {
bt_set_bondable(false);
} else {
return -EINVAL;
}
return 0;
}
static void auth_passkey_display(struct bt_conn *conn, unsigned int passkey)
{
char addr[BT_ADDR_LE_STR_LEN];
@ -2218,6 +2238,7 @@ static const struct shell_cmd bt_commands[] = {
{ "clear", cmd_clear },
#if defined(CONFIG_BT_SMP) || defined(CONFIG_BT_BREDR)
{ "security", cmd_security, "<security level: 0, 1, 2, 3>" },
{ "bondable", cmd_bondable, "<bondable: on, off>" },
{ "auth", cmd_auth,
"<auth method: all, input, display, yesno, confirm, none>" },
{ "auth-cancel", cmd_auth_cancel, HELP_NONE },