From 10cdcaa9bc6a49d98dcd3b3c1bf3c807ff82a578 Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Fri, 26 Jan 2007 15:02:48 +0000 Subject: Check if the HCI_LM_ENCRYPT is already active --- input/storage.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/input/storage.c b/input/storage.c index fab7d6c2..5f467efb 100644 --- a/input/storage.c +++ b/input/storage.c @@ -219,6 +219,11 @@ int encrypt_link(bdaddr_t *src, bdaddr_t *dst) if (ioctl(dd, HCIGETCONNINFO, (unsigned long) cr) < 0) goto fail; + if (cr->conn_info->link_mode & HCI_LM_ENCRYPT) { + /* Already encrypted */ + goto done; + } + if (hci_authenticate_link(dd, htobs(cr->conn_info->handle), 1000) < 0) { error("Link authentication failed: %s (%d)", strerror(errno), errno); @@ -231,6 +236,7 @@ int encrypt_link(bdaddr_t *src, bdaddr_t *dst) goto fail; } +done: free(cr); hci_close_dev(dd); -- cgit