Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3111580pxb; Tue, 24 Aug 2021 15:40:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfwKJ0s3+o1HHnWcBmJSnVI/V4WQr8/IpsgKQdyA5KnXSz+QR7TXSwVDBmYEFK38/1kY5b X-Received: by 2002:a17:906:2817:: with SMTP id r23mr42106057ejc.285.1629844811710; Tue, 24 Aug 2021 15:40:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629844811; cv=none; d=google.com; s=arc-20160816; b=Ko/fo341NlVnG1I/QK5x3PmqhFzXH0J2S59gJXml+tr9/OdVunpCKD7P458dGJ6m+h OLIB7DMRE8XPTBiSW5+x6lSTphSaelD32soQeWj+SlL2GK40LCo1hZydY2wl2qty08uc kxoWpAH0vMWnnmknIz5c0Gne8Kn6vMggRFZya0JqnhqN5SnPbSBXs6gw/UP9wqA5rXIR 16XHlwvfo+PIfY3YG4e3pdD5OjSN1FWXGlrLLYN2GqNAj+t4YSh2BDCKPKsZgGU/TEBA xnQSFQ8nBhT6a8ilpaMVSx7/nA2GSIMbgMeW3cfcGnxhTmRlAVZyiv9RY6lXOQqDq0mE Havg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=TqmNWaYmYIkDv2HoLvGXNvKQdovEkPQFqubZX6Uqce4=; b=Y6gP9rigWhGeGHmZPNwdrFHpuOJpgX+vLM6e+SJ5aQigAL+O4aj2RSJeWnghin7VLz iFuKyQytFQgGGHexyYFiecGCA7iWCdfXz/+eI0gNSg4FF5InvUDLNy+fABGa+jYqc7E2 Mxvs1s35WZCRzu5/GgnOWin3tG3ktmQ8mX4mrqXsIWKC+7p+OoH1H9QShmNRazDjBuPE mRcKXZ5LuLS3c69SfvGIDHvybsad6raq9sUlmP6qSSEREpdLG7H6PtdDiGU7SSeYQbeW EmGs+SdQMqqZXHe/CvQOPrHGDpqf9GVtEruUudBVZNeUrZaSEkc3r+ND6ODTYkmBqxx3 MNDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=G1DsILJx; 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 gn9si8901832ejc.550.2021.08.24.15.39.30; Tue, 24 Aug 2021 15:40:11 -0700 (PDT) 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=G1DsILJx; 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 S229521AbhHXWhp (ORCPT + 99 others); Tue, 24 Aug 2021 18:37:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbhHXWho (ORCPT ); Tue, 24 Aug 2021 18:37:44 -0400 Received: from mail-ua1-x92a.google.com (mail-ua1-x92a.google.com [IPv6:2607:f8b0:4864:20::92a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17144C061757 for ; Tue, 24 Aug 2021 15:37:00 -0700 (PDT) Received: by mail-ua1-x92a.google.com with SMTP id x23so5794057uav.3 for ; Tue, 24 Aug 2021 15:37:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TqmNWaYmYIkDv2HoLvGXNvKQdovEkPQFqubZX6Uqce4=; b=G1DsILJxcHZYn6cbFag9KlDCjhfRZhwOB3bQymiS9yUbjJ+TsWpWcOQ450kshtS6ed BRO+3vEutKz4CV30oLCvc0u6+qOo9fkf7ME1apZjFG1U7YfgxMgkx8EKxNYVjbFd3nuZ C7WgzoEFv6dNx82tU+awiPzUEn3dMmaGedhMoUFAl4REBTDz/nAfPjsEDiwFG2WWWCqZ nTx9s6iWWx5Ibhq31eu6Wf/lNRcdXIJCfbm6E1NDYmAQZVl+g06621GJE3zEHvEeFIaT NSn+ljI2Vyi+H8lsRbY+C7bEiZXyvXeFSU5dw6Yvuzf3vXsFtFA1y++AsLT0gMiLE0WC zUWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TqmNWaYmYIkDv2HoLvGXNvKQdovEkPQFqubZX6Uqce4=; b=psLU5n90OKVeeEHnDJ6VY242ikcJzcCDN2XgLaV3xAqQlHjDti/WjLp/YJOSGlNvR+ M4bL/J/RNVUn+rBxcjU5wOaXkIq4AyrHXne8u3EcGlk04eJSz5+ACyXhoRS6A10jTzx7 jUNQEwS4W0e81l1D5cbYhdECRh+TpAVX61wplkm7otNfLho6IFQjox1BJKVH686SbQhA EY/wY9UyLSBF4NmhknxU+krNacR0u3ACC08yE0epDpCk5iXusfW64VLTOW4X/AXNh/Pg ReA49yWUriRxCTSnQRqdNjMBIMjdJ6BGyGQRmJ02pBn1EeRYNZV2Spa+Pepelh6i/FgV iZKQ== X-Gm-Message-State: AOAM530uBIX5abyt2bVWoRKMJoAbEKm0FKJfPmXq/1QH1POms3DBDum0 G51EtdhsP2yM9DvLlZnQYoWTn2b0lv1Bd5wb1O005PRAysc= X-Received: by 2002:a67:f10a:: with SMTP id n10mr9917788vsk.18.1629844618851; Tue, 24 Aug 2021 15:36:58 -0700 (PDT) MIME-Version: 1.0 References: <20210824182916.2569317-1-david@lechnology.com> In-Reply-To: <20210824182916.2569317-1-david@lechnology.com> From: Luiz Augusto von Dentz Date: Tue, 24 Aug 2021 15:36:47 -0700 Message-ID: Subject: Re: [PATCH BlueZ] device: fix advertising data UUIDs ignored when Cache = yes To: David Lechner Cc: "linux-bluetooth@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi David, On Tue, Aug 24, 2021 at 12:00 PM David Lechner wrote: > > When [GATT] Cache = yes is set in configuration BlueZ does not use > cached UUIDs for the list of service UUIDs. However, it doesn't clear > the in-memory list of UUIDs received from advertising data, so when > a device is scanned, connected and disconnected, the internal state > still reflects that the UUIDs from the advertising data have already > been handled. device_add_eir_uuids() ignored the UUIDs from the > advertising data because both dev->le_state.svc_resolved == true and > dev->eir_uuids still contains the UUIDs from the previous scan session. > > This fixes the issue by resetting both le_state.svc_resolved and > eir_uuids when the device is disconnected. > > Issue: https://github.com/bluez/bluez/issues/192 > Signed-off-by: David Lechner > --- > src/device.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/src/device.c b/src/device.c > index 807106812..48b9bd8d6 100644 > --- a/src/device.c > +++ b/src/device.c > @@ -3129,6 +3129,12 @@ void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type) > > device_update_last_seen(device, bdaddr_type); > > + if (!gatt_cache_is_enabled(device)) { > + device->le_state.svc_resolved = false; > + g_slist_free_full(device->eir_uuids, g_free); > + device->eir_uuids = NULL; > + } We might want to cleanup the eir_uuid regardless of the cache being enabled, since the next time the device advertise it may have completely different UUIDs, as for resetting the svc_resolved Id guess it would be better placed at gatt_cache_cleanup since that is clearing the db it means should be cache left with should also set svc_resolved = false. > g_dbus_emit_property_changed(dbus_conn, device->path, > DEVICE_INTERFACE, "Connected"); > > -- > 2.25.1 > -- Luiz Augusto von Dentz