diff options
author | Frédéric Danis <frederic.danis@linux.intel.com> | 2012-12-05 12:43:54 +0100 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-12-05 17:24:38 +0200 |
commit | 703dd8b404b3be66e8ff491882eeeffdb55d16aa (patch) | |
tree | 0a942f9190b771828379ed8a6859dfa9343e1c99 /tools/hciconfig.c | |
parent | 0375042892032d27c18c96ff507bd80372a7decf (diff) | |
download | bluez-703dd8b404b3be66e8ff491882eeeffdb55d16aa.tar.gz |
hciconfig: Remove putkey command
With new storage architecture legacy storage "linkkeys"
file doesn't exist anymore.
Diffstat (limited to 'tools/hciconfig.c')
-rw-r--r-- | tools/hciconfig.c | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/tools/hciconfig.c b/tools/hciconfig.c index b0a4f3b27..fe88ec8d3 100644 --- a/tools/hciconfig.c +++ b/tools/hciconfig.c @@ -1011,69 +1011,6 @@ static void cmd_voice(int ctl, int hdev, char *opt) } } -static int get_link_key(const bdaddr_t *local, const bdaddr_t *peer, - uint8_t *key) -{ - char filename[PATH_MAX + 1], addr[18], tmp[3], *str; - int i; - - ba2str(local, addr); - create_name(filename, PATH_MAX, STORAGEDIR, addr, "linkkeys"); - - ba2str(peer, addr); - str = textfile_get(filename, addr); - if (!str) - return -EIO; - - memset(tmp, 0, sizeof(tmp)); - for (i = 0; i < 16; i++) { - memcpy(tmp, str + (i * 2), 2); - key[i] = (uint8_t) strtol(tmp, NULL, 16); - } - - free(str); - - return 0; -} - -static void cmd_putkey(int ctl, int hdev, char *opt) -{ - struct hci_dev_info di; - bdaddr_t bdaddr; - uint8_t key[16]; - int dd; - - if (!opt) - return; - - dd = hci_open_dev(hdev); - if (dd < 0) { - fprintf(stderr, "Can't open device hci%d: %s (%d)\n", - hdev, strerror(errno), errno); - exit(1); - } - - if (hci_devinfo(hdev, &di) < 0) { - fprintf(stderr, "Can't get device info for hci%d: %s (%d)\n", - hdev, strerror(errno), errno); - exit(1); - } - - str2ba(opt, &bdaddr); - if (get_link_key(&di.bdaddr, &bdaddr, key) < 0) { - fprintf(stderr, "Can't find link key for %s on hci%d\n", opt, hdev); - exit(1); - } - - if (hci_write_stored_link_key(dd, &bdaddr, key, 1000) < 0) { - fprintf(stderr, "Can't write stored link key on hci%d: %s (%d)\n", - hdev, strerror(errno), errno); - exit(1); - } - - hci_close_dev(dd); -} - static void cmd_delkey(int ctl, int hdev, char *opt) { bdaddr_t bdaddr; @@ -1980,7 +1917,6 @@ static struct { { "sspmode", cmd_ssp_mode, "[mode]", "Get/Set Simple Pairing Mode" }, { "aclmtu", cmd_aclmtu, "<mtu:pkt>", "Set ACL MTU and number of packets" }, { "scomtu", cmd_scomtu, "<mtu:pkt>", "Set SCO MTU and number of packets" }, - { "putkey", cmd_putkey, "<bdaddr>", "Store link key on the device" }, { "delkey", cmd_delkey, "<bdaddr>", "Delete link key from the device" }, { "oobdata", cmd_oob_data, 0, "Get local OOB data" }, { "commands", cmd_commands, 0, "Display supported commands" }, |