Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp906447ybz; Fri, 1 May 2020 10:41:29 -0700 (PDT) X-Google-Smtp-Source: APiQypKeyorgvZGY8vMAUnsiRDtcBqymYqWJSRjmejAGElrsEW/Ky8aGPTpfnkzzxbe3GqFBUT3H X-Received: by 2002:a17:906:5958:: with SMTP id g24mr4469090ejr.58.1588354889654; Fri, 01 May 2020 10:41:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588354889; cv=none; d=google.com; s=arc-20160816; b=ZMlSCQHbm34PsqduNGcykMd/dAt0XjNznSSjxKcJ9etolCfvYLPxw3+WEdpJIu8zYx SbWBNDYaBOECLwTOmRbHcu0XHw9EgTyenTuaJs+XLWF9hQwHjpva6MojyQzutrjI2HyC VATov1f8CF9vfGJReVXdf+0paqDWKLD5R/umikFeEfMVgP5hadZ4vzGMrIAB/RGX4PNp BGFsi2dE/o2lEeCor+cGYcQtwJkhTJw7sczJ6RGPk452JjM16jwROOqewQiF57Hc7O7i M7NPXB0PQiA+Tq7Spz+KORZLBg19r8bFcUYfkA/ixnOZo0Mgj2qKmhA5AA6xF0EUwPCm mt/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=AvoZcybB+C+WEQaUiBLplnF5GWMC5z6qQfjFgXMPod4=; b=GrjnF7MniqQqJ58CEs17vL9SJnKmkTlVEpWUxi/boWr8W7IpDYtxzRDvUek82JaQiu I2QNYWcZSYIRxKQ27kmImv0NhdknPvIqSwkrC7KKlS+HCcIg5sfKY59egtuivGXB1NYx oLb2WlEsMuGHM48uSmpRWdSoWo+aXKQNnxVjAKZHyVofwyO1iJZOJp8XxxbSvjUUuMe5 NLKk/4OtvOeLJ8CVOvBW2SYaHTUUZRHNsUsHRN3i4lUiBvGsrCVqU+VhFUxw0ziiPmzO j0wztv4qdyakZMl4g6CVihbH5RL6ZBEvyfxKVZn/ZZbUMgB5zPejVkYRPBs66zI09bE8 ACwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=F5jJVOTF; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cf5si2201912ejb.171.2020.05.01.10.41.05; Fri, 01 May 2020 10:41:29 -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=@google.com header.s=20161025 header.b=F5jJVOTF; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730280AbgEARkx (ORCPT + 99 others); Fri, 1 May 2020 13:40:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729572AbgEARkw (ORCPT ); Fri, 1 May 2020 13:40:52 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84DA1C061A0C for ; Fri, 1 May 2020 10:40:52 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id t11so4406342lfe.4 for ; Fri, 01 May 2020 10:40:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AvoZcybB+C+WEQaUiBLplnF5GWMC5z6qQfjFgXMPod4=; b=F5jJVOTFXokcNkuQ1Zk8OVzSrIVakAeKxETqY4gf1zE67zq6eki5POPWY99DBHpQUo I4QtJuGLfy5m+9X4odOyeXZT7qRFvVSamQ6WmXDXmD4DzZkHciVmIxmI2Bsfaxh2y6zJ wB2fNf0RypGSQCZ8VYhQdj7JC4K6KM19flnatmMP4ddw2UxkFF6c1JS3xRw/NSnSdv5f 7CWiIyxclemhZspUywKDv44DX7sc4nnl7x4lHfXG6AhtmPx3VAXIIZXOYSmCdvjJkSye fmydtdhhqUYnQ3PKB08hzcqjoa59qka9oR69COlP4ybpOt4p5DsIMp7A6EDm3HKRvEBM rkjw== 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=AvoZcybB+C+WEQaUiBLplnF5GWMC5z6qQfjFgXMPod4=; b=fmrei6g65Jlxl5cxv5HDTTlP9fqaBva0JiSYdQJczv7f85d6dra8OurB2/SeP2LAbM quoWdq4103lmsNCmAge6cODvjPGS0UuZsdTp1eLQWDRDuTXYNcWwGjeF2suV1qCxEFuN VJKJ2hTyfRJ/KZ3fTqRVL7kvWxf7Y4w+N6YArzJxCSP7PPMrrh/e7kSmDLEtaN6ROQOM D5AJIQ2RVYueA75o+dSivqxXQKg+/BohoKq/2x2NUs/cl0j4eNIT+dwQPsrHh4eKt0c8 O/m1IXa7EAsyVJBljocIWpq36BTQOGCXkVGKdcS2bsbPRGwSMdKOupPEp/EWIOQ4MSzl n61g== X-Gm-Message-State: AGi0PuZlOPj0UoZ/1eL5nifgq39yaH/2Uy8a6ue/Y4X/GaXX7Y8sEAki bwYxB/FHvbzeFACukKqjkkRAfs4IwO6JJTkF481BeA== X-Received: by 2002:a19:6a18:: with SMTP id u24mr3229653lfu.191.1588354850782; Fri, 01 May 2020 10:40:50 -0700 (PDT) MIME-Version: 1.0 References: <20200501144037.1684-1-alainm@chromium.org> <4195BFB9-1586-435F-8FC2-ED215959A591@holtmann.org> <215E5E68-A360-4DD7-8DBC-E46278729FC6@holtmann.org> In-Reply-To: <215E5E68-A360-4DD7-8DBC-E46278729FC6@holtmann.org> From: Alain Michaud Date: Fri, 1 May 2020 13:40:39 -0400 Message-ID: Subject: Re: [BlueZ PATCH v1] shared/gatt-client:Ignore orphaned characteristics To: Marcel Holtmann Cc: Alain Michaud , BlueZ Content-Type: text/plain; charset="UTF-8" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Fri, May 1, 2020 at 1:32 PM Marcel Holtmann wrote: > > Hi Alain, > > >>> The gatt discovery proceedure simplification to discover all > >>> characteristics at once has exposed a device side issue where some > >>> device implementation reports orphaned characteristics. While this > >>> technically shouldn't be allowed, some instances of this were observed > >>> (namely on some Android phones). > >>> > >>> The fix is to simply skip over orphaned characteristics and continue > >>> with everything else that is valid. > >>> > >>> This has been tested as part of the Android CTS tests against an > >>> affected platform and was confirmed to have worked around the issue. > >>> --- > >>> > >>> src/shared/gatt-client.c | 5 ++++- > >>> 1 file changed, 4 insertions(+), 1 deletion(-) > >>> > >>> diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c > >>> index 963ad619f..d604c77a3 100644 > >>> --- a/src/shared/gatt-client.c > >>> +++ b/src/shared/gatt-client.c > >>> @@ -632,7 +632,10 @@ static bool discover_descs(struct discovery_op *op, bool *discovering) > >>> util_debug(client->debug_callback, client->debug_data, > >>> "Failed to insert characteristic at 0x%04x", > >>> chrc_data->value_handle); > >>> - goto failed; > >>> + > >>> + /* Skip over invalid characteristic */ > >>> + free(chrc_data); > >>> + continue; > >>> } > >> > >> should we add a warning here? > > Is there a good way other than the util_debug mechanism to write a warning? > > you could just use btd_warn() here. If this gets too noisy, we either remove it later or we introduce a btd_warn_ratelimited() or btd_warn_once(). This being under src/shared, I wasn't sure if that was acceptable to add a btd dependency here, especially with the work to avoid it via the util_debug. Happy to do either way, just want to make sure the guidance is clear. > > Regards > > Marcel >