From 8e6cc8d1c48d343500bbfc3ab2990e82708831bb Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Sat, 13 Sep 2008 19:02:22 -0300 Subject: Input: Checking if the link is already encrypted --- input/device.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/input/device.c b/input/device.c index 0039c4f2..f4748dbf 100644 --- a/input/device.c +++ b/input/device.c @@ -641,15 +641,19 @@ static int hidp_add_connection(const bdaddr_t *src, const bdaddr_t *dst, int ctr if (name) strncpy(req->name, name, 128); + /* Encryption is mandatory for keyboards */ if (req->subclass & 0x40) { err = bt_acl_encrypt(src, dst, encrypt_completed, req); - if (err < 0) { + if (err == 0) { + /* Waiting async encryption */ + return 0; + } else if (err != -EALREADY) { error("bt_acl_encrypt(): %s(%d)", strerror(-err), -err); goto cleanup; } - /* Waiting async encryption */ - return 0; + /* Link already encrypted - reset error */ + err = 0; } /* Encryption not required */ -- cgit