mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-29 23:24:20 +08:00
tools: Add command to clear long term keys
This commit is contained in:
parent
d6a9e8a7fb
commit
ceaf091426
@ -1548,6 +1548,33 @@ static void cmd_keys(struct mgmt *mgmt, uint16_t index, int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
static void ltks_rsp(uint8_t status, uint16_t len, const void *param,
|
||||
void *user_data)
|
||||
{
|
||||
if (status != 0)
|
||||
fprintf(stderr, "Load keys failed with status 0x%02x (%s)\n",
|
||||
status, mgmt_errstr(status));
|
||||
else
|
||||
printf("Long term keys successfully loaded\n");
|
||||
|
||||
mainloop_quit();
|
||||
}
|
||||
|
||||
static void cmd_ltks(struct mgmt *mgmt, uint16_t index, int argc, char **argv)
|
||||
{
|
||||
struct mgmt_cp_load_long_term_keys cp;
|
||||
|
||||
if (index == MGMT_INDEX_NONE)
|
||||
index = 0;
|
||||
|
||||
memset(&cp, 0, sizeof(cp));
|
||||
|
||||
if (mgmt_send(mgmt, MGMT_OP_LOAD_LONG_TERM_KEYS, index, sizeof(cp), &cp,
|
||||
ltks_rsp, NULL, NULL) == 0) {
|
||||
fprintf(stderr, "Unable to send load_ltks cmd\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
static void block_rsp(uint16_t op, uint16_t id, uint8_t status, uint16_t len,
|
||||
const void *param)
|
||||
{
|
||||
@ -1966,7 +1993,8 @@ static struct {
|
||||
{ "pair", cmd_pair, "Pair with a remote device" },
|
||||
{ "cancelpair", cmd_cancel_pair,"Cancel pairing" },
|
||||
{ "unpair", cmd_unpair, "Unpair device" },
|
||||
{ "keys", cmd_keys, "Load Keys" },
|
||||
{ "keys", cmd_keys, "Load Link Keys" },
|
||||
{ "ltks", cmd_ltks, "Load Long Term Keys" },
|
||||
{ "block", cmd_block, "Block Device" },
|
||||
{ "unblock", cmd_unblock, "Unblock Device" },
|
||||
{ "add-uuid", cmd_add_uuid, "Add UUID" },
|
||||
|
Loading…
Reference in New Issue
Block a user