Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3470389pxb; Mon, 4 Apr 2022 18:00:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxj/cVjti7WXY3xSYWS62AoDIaC9/NwZkOrdUOgceel5bWYME2H89PMARQOoG+jsdcrbUnI X-Received: by 2002:a17:902:aa4c:b0:156:547b:df7b with SMTP id c12-20020a170902aa4c00b00156547bdf7bmr879240plr.20.1649120449168; Mon, 04 Apr 2022 18:00:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649120449; cv=none; d=google.com; s=arc-20160816; b=fH/RriEriv77eOZ5wNJXVmghgWNC6nhRcnhJTZ1F3RYwGgkArrwFLxLQ7Pc1NncpAy nBdQrjFRlmK98Wr6Qa+Kfha2Ll014c2wkPKHGmKjJ8VgcxyZ/E9D4oyIpfrfpu7epJDo 4/IPmnK5HN5mNtUVAYdtqYMJr9V8P145mIEupswwTgzwqMla6trRnEDRkiZc1PLKEbIn HZ3Z5IBwmEW05+tXdfVyBh7A/xpsoZWKH+emRkmvH+Dh5E/6g7mBQhgj0uhVORyEQipO b2+41LRIZv6wwKUkhFdO7E8viVn31dqATydowU4a8JuavXteiaXJNGQdqopvTey018eG i+ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=iW69SAcVB27e5hZHnVV5J2SFFjF3daE6twYBTwITpwY=; b=LsaJM/ISV/8FP/USXx9B44BZyB1/SuTJHzVJjsCyCDzwrJlwk3Z3wZnM1OwxgDXcxF j2PCthzZ44CQjF98BLpyWWad4U87vByyeCvGNQa73pgOhpf4f61sinn+5KxlDp9YBMSc 0am+XTEK/8CuGSJNp01WnWpnNcPZ1WsLE4Sgk1UlA/z06+LnNbGfl7Fzta6zZK2gjAq2 ijJhiWK+udHLRK0gHV2txp5HaJbULzX9djA2y8CghjXYx2VWKkqfSf4RsuHX2jJ0k3PX vvqqwtEL2lmumeHST0SFYp9avhLtDjEhjtWq+2nS+WsKJvnl02L5Q5AxeiLMOhXfscSg 78fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MxjGa6fb; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id pg11-20020a17090b1e0b00b001bd14e03053si813814pjb.43.2022.04.04.18.00.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 18:00:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MxjGa6fb; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1: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: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1B612158DB2; Mon, 4 Apr 2022 17:07:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380369AbiDDV2j (ORCPT + 99 others); Mon, 4 Apr 2022 17:28:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380666AbiDDUxx (ORCPT ); Mon, 4 Apr 2022 16:53:53 -0400 Received: from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com [IPv6:2607:f8b0:4864:20::1129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 872932D1F3 for ; Mon, 4 Apr 2022 13:51:56 -0700 (PDT) Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-2eb888cf7e7so26248277b3.13 for ; Mon, 04 Apr 2022 13:51:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=iW69SAcVB27e5hZHnVV5J2SFFjF3daE6twYBTwITpwY=; b=MxjGa6fbQ6Q3GzQmShz40aGd5O4IA2OFa7jG6dLrh0HvM3mCtEnmJVfQnhzotPQ1dw vJZtiul9Ug2p7czaWfK4JJh77/m6E7v6bLNy7NGVDHq3+bZiWuAB97Wj7fMy4rCu69+y 3WiGLm/a4JKRQnrNA4l58tBXtphC+GhABz2R4bDzDpoKqZCisVPlwZFGLnvA5dmodSDe R+yl1tUTtwBYwL+cbzV5coHEIbO6Ud6BYA/cZ5H54QuMl+IiNWIz7BbMWBvHaadbeeiw 90QvmtLJoRBFMr+DWG4nRtai+ALcbiJbGchPg7vSnT87iClP5OhZr1WE6l9goZHLkyHc ufmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=iW69SAcVB27e5hZHnVV5J2SFFjF3daE6twYBTwITpwY=; b=R4hOVNhMkK8Qgc4InHfBCXHZ6RPqjofkBl1MCq5a6fU7oGd5G3PzyzOoHXkTFDIbql oohzoRUj6bokJ9CUZxU1FbXTGkCeOuwr4P3Hjxz3+G9ahXhZnhkRVoh/YdEh3Ndl+V8x pzCg2mYoDpQZeDzVRHdKqzmx0VW+0GebTSFknB4wNNQpTn271JSwbHOnUS7qYw0L463A ZAbTxGZXicdSNG9kqQeY23ZXAgzKDsagqZ1nOnHaE3PRllz/XLLxfVMcIfWzFJ0UwfW+ uWOdmh8wjqlr4Zvcf8BKC2+9+DM8dhvb0KjNjZfP+QDoOQ6PgQn7uqCEI+02IoQy1AU9 e/Iw== X-Gm-Message-State: AOAM5324Jjm9xY/3yXumUgcKY/NHZXoZpFZv+4rGI1ld5KPxDGY+d45F cZr7pD2G7SlWIuRjl7QYOiz1zGambzBcLbYgXMmDxQPK X-Received: by 2002:a81:c305:0:b0:2eb:9875:76fd with SMTP id r5-20020a81c305000000b002eb987576fdmr1759246ywk.317.1649105515646; Mon, 04 Apr 2022 13:51:55 -0700 (PDT) MIME-Version: 1.0 References: <20220404201750.1082470-1-luiz.dentz@gmail.com> In-Reply-To: <20220404201750.1082470-1-luiz.dentz@gmail.com> From: Luiz Augusto von Dentz Date: Mon, 4 Apr 2022 13:51:45 -0700 Message-ID: Subject: Re: [RFC BlueZ] gap: Don't attempt to read the appearance if already set To: "linux-bluetooth@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Adam, On Mon, Apr 4, 2022 at 1:17 PM Luiz Augusto von Dentz wrote: > > From: Luiz Augusto von Dentz > > Devices are unlikely to change appearance over time which is the reason > why we cache then on the storage so this skips reading it on every > reconnection. > --- > profiles/gap/gas.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/profiles/gap/gas.c b/profiles/gap/gas.c > index ea3249be9..400818d67 100644 > --- a/profiles/gap/gas.c > +++ b/profiles/gap/gas.c > @@ -142,6 +142,11 @@ static void read_appearance_cb(bool success, uint8_t att_ecode, > > static void handle_appearance(struct gas *gas, uint16_t value_handle) > { > + uint16_t value; > + > + if (!device_get_appearance(gas->device, &value)) > + return; > + > if (!bt_gatt_client_read_value(gas->client, value_handle, > read_appearance_cb, gas, NULL)) > DBG("Failed to send request to read appearance"); > -- > 2.35.1 Check if the above works for you. -- Luiz Augusto von Dentz