Return-Path: From: =?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= To: linux-bluetooth@vger.kernel.org Cc: Paulo Alcantara Subject: [PATCH BlueZ v4 12/15] core: Disable unnecessary auto connections Date: Thu, 30 Aug 2012 19:15:57 -0300 Message-Id: <1346364960-7699-13-git-send-email-jprvita@openbossa.org> In-Reply-To: <1346364960-7699-1-git-send-email-jprvita@openbossa.org> References: <1346364960-7699-1-git-send-email-jprvita@openbossa.org> Sender: linux-bluetooth-owner@vger.kernel.org List-ID: From: Paulo Alcantara BlueZ host disconnects the link when encryption fails. ECONNABORTED error is returned by the kernel when the connection is terminated by the local host. This scenario commonly happens when authentication fails due PIN or Key Missing. --- src/device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/device.c b/src/device.c index 1093237..b0c4b12 100644 --- a/src/device.c +++ b/src/device.c @@ -1950,6 +1950,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 (g_error_matches(gerr, BT_IO_ERROR, ECONNABORTED)) + return; + if (device->auto_connect == FALSE) return; -- 1.7.11.4