summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-09-10 01:20:02 +0200
committerMarcel Holtmann <marcel@holtmann.org>2008-09-10 01:20:02 +0200
commit9edd39d0d4bb7e595445b2636d1e4f7e95aacc3a (patch)
treed2c4aa198a63a9fb57af70aa78bbf11be5b07abd
parent14dd201d51b5044160247bd045e7692cfa5efc5b (diff)
Send authentication request without blocking
-rw-r--r--input/device.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/input/device.c b/input/device.c
index 2fffe7c3..1726ed97 100644
--- a/input/device.c
+++ b/input/device.c
@@ -477,7 +477,7 @@ static int encrypt_link(const char *src_addr, const char *dst_addr)
char filename[PATH_MAX + 1];
struct hci_conn_info_req *cr;
int dd, err, dev_id;
- uint32_t handle;
+ auth_requested_cp cp;
char *str;
create_name(filename, PATH_MAX, STORAGEDIR, src_addr, "linkkeys");
@@ -517,19 +517,24 @@ static int encrypt_link(const char *src_addr, const char *dst_addr)
goto done;
}
- handle = htobs(cr->conn_info->handle);
+ memset(&cp, 0, sizeof(cp));
+ cp.handle = htobs(cr->conn_info->handle);
- if (hci_authenticate_link(dd, handle, 20000) < 0) {
+ if (hci_send_cmd(dd, OGF_LINK_CTL, OCF_AUTH_REQUESTED,
+ sizeof(cp), &cp) < 0) {
error("Link authentication failed: %s (%d)",
strerror(errno), errno);
goto fail;
}
+#if 0
+ /* FIXME: This needs to be done after auth completed */
if (hci_encrypt_link(dd, handle, 1, 5000) < 0) {
error("Link encryption failed: %s (%d)",
strerror(errno), errno);
goto fail;
}
+#endif
done:
g_free(cr);