diff options
| author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2008-09-13 19:02:22 -0300 | 
|---|---|---|
| committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2008-09-13 19:02:22 -0300 | 
| commit | 8e6cc8d1c48d343500bbfc3ab2990e82708831bb (patch) | |
| tree | ec0a3bcfbaad03f830e2d1501fcb153505f712b9 | |
| parent | f0e96d61d2b74cd809e91597d0e08aee8fe68cad (diff) | |
Input: Checking if the link is already encrypted
| -rw-r--r-- | input/device.c | 10 | 
1 files 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 */ | 
