Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3402394pxb; Mon, 4 Apr 2022 15:52:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSgavnAobi7iNEiId9k8dTGtL0XrAfEUtGQn/MVLxK/WNVl1dBokuTH/arqCplN8tzggCh X-Received: by 2002:a05:6a00:234f:b0:4f6:f0c0:ec68 with SMTP id j15-20020a056a00234f00b004f6f0c0ec68mr464227pfj.14.1649112761000; Mon, 04 Apr 2022 15:52:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649112760; cv=none; d=google.com; s=arc-20160816; b=Z4csN8ScuNAdK7FHpqV3xLRO+DmBn14E1ATn3kwaraTdQS3UhRmHwcC+QlxQ9usiU/ rMuZecdIzbvHrHj4XU33phBAyA86g9ka9ebst90XKF1gSLSo4662fJpp4Y1G1C7xxPFy 4KRDaj5zt1AVf7MuZTEIYvw9g0dvmGz2XaGVOsiiM7pykwv7GDkhvVBCBC37QivIy4v9 JCQ35T3EjYrEGgrK/F4bw/oS/ZAFXYirWaS33Y2Q3/YMUWUm3RUpHt4KiZRFyuC9Rnjj QvZy5Biz45T6NdRVKdVQrGRKOLLqp/3J5OFGSp2rfeH3LX1AdpFTjvEJsbudnVZNQkEH 4guA== 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 :message-id:date:subject:to:from:dkim-signature; bh=VkuZxi+FO4+RB8h1ano29K4ElRCpisBCc+2d5OMebQw=; b=jdirZZlIvRKUu/075TgSlODN1GfK5plXhp8MvqcFj2JGG17RR+VpS0UBx0XvcKA/n8 UcdewC6kV/Ka0jttdZfQi2ixoVU9YMF0o3nQ/w0Sp+AXkd3mEHPF6dXxnYR+rVLpqoJF 3wyrnVHESkuZ5GFhXkHpzfUQHqRT5+D4zztSJx3S7Fg795f65+QTd/y+ov8TOHdp3fSU Lcp160hNnU65pI+gpqk5uccL++u7ts2JJ6Ih3TLs0p2aySbE2q9JMU6NhAEqwWVuimh+ zaidV+6Kz1v90ai6I1tEM6gV4JJSlIHbDP34vc621urVh0awYxX4GJe0IjER8aWcElMf mAww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=q4D2DkA6; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v34-20020a634662000000b00398ee6d6427si8672303pgk.335.2022.04.04.15.52.21; Mon, 04 Apr 2022 15:52:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=q4D2DkA6; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1379386AbiDDV2e (ORCPT + 99 others); Mon, 4 Apr 2022 17:28:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380493AbiDDUTs (ORCPT ); Mon, 4 Apr 2022 16:19:48 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 797C533EB0 for ; Mon, 4 Apr 2022 13:17:52 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id q142so7487510pgq.9 for ; Mon, 04 Apr 2022 13:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=VkuZxi+FO4+RB8h1ano29K4ElRCpisBCc+2d5OMebQw=; b=q4D2DkA6iSL5XyQMSDTaijiFb+rOwh5h7CvMGgxyn0k/xIJeGFqr0g/Sqc/P8bZRxO OS+QVN7FSdDg08xtUsMMMB7zQQO4+esvCD8RAlUt7CWpQ6Uz4JvYArMNZuBNKEOZ5cOC FlDOjL4AwNyDFmXU3au/MG7lDkgPFzNKVQccGDeUYFTwS6ZEmwgiu1Cq89UFJTepLXx0 nYG1JfNMgs/Ipe4Cg5IwUnKaQbOVOsNJq4s4Oc4rIqVD1O1lQzYtZGvQLiKS5XLrBZhc AfG6PUPPl4mX+6Ox+CAgsdiNPqs0OV2aNyWlydKLXLfmlvjh2IUxgu94nKWcAfesGbOa rFvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=VkuZxi+FO4+RB8h1ano29K4ElRCpisBCc+2d5OMebQw=; b=a58LpQsVi1UKqvYZ/ScGjye4QyYXznnx4110Xn7MxZ9BriGDIgTCfL25CJgDYy/dEo 5KngnF1iPv2nKM8oQs5KaOeTquXmUrQDa9JR7DV8D22IMVoMZVM407ABlbKzAxFNZ30x UfaHmHwcMNJMy0RzTSi+7ABDHfojRxG0nrd4lLEAjGijPU74IogndGOpQMgcoNRRpZwt b8Td+A5/XRpRThAhDMoCci4aTX4wMFkaVdkcbGpEjxah12R6meG0FrmcVHlc6r1cFGKZ KgWBwbE61DRaB3J9+Ae92WMhaGZkQhnLqRf8DNubfSWYjaLK7E8T0azhOK+MUHNXcaJY XbGA== X-Gm-Message-State: AOAM532iizgs3CGl8DkGEUhea7INFMuXxhywTAke+rIRukgomag/AVOd 7jhvW0gyV6eTNpm3V0Hv7PHBaHfXWrY= X-Received: by 2002:a63:cf12:0:b0:399:38a7:5063 with SMTP id j18-20020a63cf12000000b0039938a75063mr1299818pgg.311.1649103471712; Mon, 04 Apr 2022 13:17:51 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id g70-20020a636b49000000b003823dd39d41sm10997508pgc.64.2022.04.04.13.17.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 13:17:51 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [RFC BlueZ] gap: Don't attempt to read the appearance if already set Date: Mon, 4 Apr 2022 13:17:50 -0700 Message-Id: <20220404201750.1082470-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 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