Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp611514pxb; Fri, 8 Jan 2021 13:18:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTd5+1fPZEAEQ0hyPc1jz30rV67gu17HHeEjPDFVst61dTND81SSQJRPWY+4cuOAobfPbU X-Received: by 2002:a17:906:52d9:: with SMTP id w25mr3723576ejn.504.1610140722757; Fri, 08 Jan 2021 13:18:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610140722; cv=none; d=google.com; s=arc-20160816; b=gueHvW0z8g0iJU8uN3nisaQ6pwaVAei3iG+m69VujeYpdrknSfqe709CSBdGSCgqW0 iXRkJFVzFqgBRXBohkHfourYyhvUu/fkdy+/5zQmdxtIHHnnZcfVyn8vtU12pRz1VZ05 SkJfUPp1mBXtPLIy7KjzPphK+CXd30f43dfk4OTLasq6sh7BtvDMmZaRTv4RIBzA0pQO uxALob6JhixcVHrLbOrYGgdRmb0W44K2uipT9XfDOXYOej5eEXwDJKDNApXPFGrnWB0y Z63SjgmCi01h57eQcN9aFJb5K4qX2N+buy959B8BBSAcbgdoavHvmC+Tgrg7G6x5srNX qC6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=od4kyhO8B6Ups457tn7S8TzdwrA5OCwrTrq+s7sYrME=; b=kFVXsKS/tBNn/c4Y0BMe0enb76BuGoGo7kqE5SH3Dk2COFDjX57j1+pCbUWOPa65g9 qdW2bZ/hpQyny/ULxpJzIS+eL4Pl3hyq889yd8+QboLjaXTuKXFgywmTqIyHuKGkgYrM VGoAPtxRCUuBKciN4uO1+lo/LHV/t2a8RHPKsEzgB6+EpK0gxKVe1IZ7t1SjIWDRI8rg TakrjnkcTU8JQZ8QqTTV6Z0SxfASbIpcko+guArjXYFpVfGC44jkB5IWlGVVltQiZZ7P LWdkpzmszPwz+a2wQaecyWBxMNkojL4lEunC8ZGYMLklBcA2FUPGtwOxhdGnKyU+CZ01 CF8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GxdykE+D; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y15si4583328edv.392.2021.01.08.13.18.09; Fri, 08 Jan 2021 13:18:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GxdykE+D; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729615AbhAHVQA (ORCPT + 99 others); Fri, 8 Jan 2021 16:16:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729486AbhAHVP7 (ORCPT ); Fri, 8 Jan 2021 16:15:59 -0500 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEE37C061796 for ; Fri, 8 Jan 2021 13:15:18 -0800 (PST) Received: by mail-pf1-x435.google.com with SMTP id c13so4338131pfi.12 for ; Fri, 08 Jan 2021 13:15:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=od4kyhO8B6Ups457tn7S8TzdwrA5OCwrTrq+s7sYrME=; b=GxdykE+DobF8eM8ACQxN9PmHumAZSVLOx9hWOAb2gns+cz5CLvfCZR/PXoHzJdjpxs oX/lxp1lRn9SriuKCwk3C5Jfb0xzeFkkbnh4L2lJlvLUN7imshrOjF4qgmFunahSNMtp rVLi6bjIYla+kpw6tMmbkUK+rWuVInyaFspPHTTjvEMd4t9OpwFswP4abjEbqmHTIu6R A/CjPYwud8j1ghxYAaHEvHPn1gWswHe0k6St7LtHYpOrtTv0ynEOwkK5wMpTcSwSxbwd v9LPQEYCSG+Jhk0K6HASUBNLOsmH/VSyzbSIEpxKXC9MT3yxMnflO2CUGMQcrum4nuVk PPdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=od4kyhO8B6Ups457tn7S8TzdwrA5OCwrTrq+s7sYrME=; b=qSQgAibaqfxWaotpNrovQ0SG1HnpXDoTo1HHZPwEBxABxxRbIgigfKrIuxIdOmgvo4 ulsgflRYReD+XYka0lh6qBgiR5dO/Fcz4pp9cLmfKGiieRJ1jay/QQCNcuHtUy9Ugd7b HVd2s/vRSWFdeJm9c1Q5X7kzKzu9oMnXA9OJMl6PH7k+7HHxfQ6c/Rmov9gGwjwDxQD8 7A1lUJOMENXHGpQ0ur1d0lA91QRJvz7mesxfNcAE25rmK1J9tlm1hnz/ii1rrEBsYe6r Dkg1l5EfZ6c9MW6diLr+OP0mPZgx+LUkWdYF46E4WpAYmerCB/qc4F3qPcOcxMr/XALr Q7/g== X-Gm-Message-State: AOAM530ul9vnk/1x/QZxD27v7kBF4qH1ThHRj/CiBCCIDbfcRgY/n5qZ ZkvATAxXlDkyGM0m1D7mYWON6g/j4xk= X-Received: by 2002:a63:4c09:: with SMTP id z9mr9102333pga.260.1610140518117; Fri, 08 Jan 2021 13:15:18 -0800 (PST) Received: from lvondent-mobl4.intel.com (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id 21sm9721699pfx.84.2021.01.08.13.15.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 13:15:17 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 4/4] gatt: Fix assuming service changed has been subscribed Date: Fri, 8 Jan 2021 13:15:13 -0800 Message-Id: <20210108211513.5180-4-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210108211513.5180-1-luiz.dentz@gmail.com> References: <20210108211513.5180-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz Unfortunately assuming service changed has been subscribed may cause indication to time out in some peripherals (Logitech M720 Triathlon, Mx Anywhere 2, Lenovo Mice N700, RAPOO BleMouse and Microsoft Designer Mouse) even though the expect actually mandates that the client responds with confirmation these peripherals just ignores it completely which leads them to be disconnected whenever bluetoothd is restarted or the system reboots. --- src/device.c | 11 ++--------- src/gatt-database.c | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/device.c b/src/device.c index fe885aa64..af13badfc 100644 --- a/src/device.c +++ b/src/device.c @@ -5831,18 +5831,11 @@ void device_load_svc_chng_ccc(struct btd_device *device, uint16_t *ccc_le, key_file = g_key_file_new(); g_key_file_load_from_file(key_file, filename, 0, NULL); - /* - * If there is no "ServiceChanged" section we may be loading data from - * old version which did not persist Service Changed CCC values. Let's - * check if we are bonded and assume indications were enabled by peer - * in such case - it should have done this anyway. - */ if (!g_key_file_has_group(key_file, "ServiceChanged")) { if (ccc_le) - *ccc_le = device->le_state.bonded ? 0x0002 : 0x0000; + *ccc_le = 0x0000; if (ccc_bredr) - *ccc_bredr = device->bredr_state.bonded ? - 0x0002 : 0x0000; + *ccc_bredr = 0x0000; g_key_file_free(key_file); return; } diff --git a/src/gatt-database.c b/src/gatt-database.c index b7d2bea1d..d99604826 100644 --- a/src/gatt-database.c +++ b/src/gatt-database.c @@ -333,7 +333,7 @@ static void att_disconnected(int err, void *user_data) handle = gatt_db_attribute_get_handle(state->db->svc_chngd_ccc); ccc = find_ccc_state(state, handle); - if (ccc) + if (ccc && ccc->value) device_store_svc_chng_ccc(device, state->bdaddr_type, ccc->value); -- 2.26.2