aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulo Alcantara <paulo.alcantara@openbossa.org>2012-06-05 20:46:01 -0300
committerJoão Paulo Rechi Vita <jprvita@openbossa.org>2012-06-21 18:00:19 -0300
commit3f3514ca6181007f8663599b074f3ab63eb0a7f5 (patch)
treee8f868556105591bef689038bc172145ef7eb87d
parentf6eba8f6bda3d31c68acac17fb839311f346cd50 (diff)
downloadbluez-3f3514ca6181007f8663599b074f3ab63eb0a7f5.tar.gz
bluez-3f3514ca6181007f8663599b074f3ab63eb0a7f5.tar.xz
bluez-3f3514ca6181007f8663599b074f3ab63eb0a7f5.zip
device: Disable unnecessary auto connections
When a remote device is disconnected from some reason and BlueZ attempts to connect to the remote device again when auto connection is enabled, the kernel exposes an errorneous number, which is the ECONNABORTED, that means the remote device connection has been terminated by user and the host must *NOT* to connect to it again but BlueZ _always_ enable auto connection as it should not. This patches checks for the ECONNABORTED in order to avoid enabling auto connections where connection won't be possible from host to remote device anymore.
-rw-r--r--src/device.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/device.c b/src/device.c
index 42e04055..5b6c3806 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1991,6 +1991,9 @@ static void att_error_cb(const GError *gerr, gpointer user_data)
struct att_callbacks *attcb = user_data;
struct btd_device *device = attcb->user_data;
+ if (gerr->code == ECONNABORTED)
+ return;
+
if (device->auto_connect == FALSE)
return;