Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp8836464pxu; Sun, 27 Dec 2020 22:25:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJwm9QSuJpVeUprP5rIzvfTP9BSwqRaDDcg5wmrcSyd/TzYqxsnYYwzgvUJf6KzaEVxdcFfL X-Received: by 2002:a17:906:adce:: with SMTP id lb14mr40334129ejb.502.1609136723447; Sun, 27 Dec 2020 22:25:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609136723; cv=none; d=google.com; s=arc-20160816; b=Zuybvk2gQWm9ZWaq8zDTiseIHFYnRcC+94DH7Umldym6eM4wp8XRyMzNgAJUAZdu9F oMOE/gHtLQyBiP83kWQbH0XGevQMorkfMLtrLVK70cljvNvvkkV8dIcqT3GOLusXaTGW bJYhzVW4w6MqVQHpEgZtDot5xD1XJGTyAXkNRXMJEdh5MKJGHjvTyLtBUE/sAx4450KB OMFiUEuS4RSjyTaT27zqj8IA/bpcCc74WQb3l+e7r+9GG1DVi9ZGegFXGiyPsB97zbg5 Ft9VtAAmgOpFhvYA4MYbNTBt6iAilCv+iUEGl7veiBTKWw28NjpK5jcEoAVC+6tCoyAX xviw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :sender:dkim-signature; bh=G8mTuI59vHARrWXenok3n0BrbeW6B94jcY14Tht2HbY=; b=iOnWmdHEs2xsOusd/7Cq4c3i6NMEFDKgXJnZKvRj5AK18Fj4zMRDK2FA4xmsnOZS+3 IHa6Alv9j3Ek71bD7N3UcB0KBcB5AA3Ig0Q99lR08dcUWkVRLFlr0YL3wYqtpvEf/zt8 8j83JOmx+FIIAhtLWntqsfhi+brXO0ZlyGCIg4JDMwyAvF4vWJYoNGZVNNPVqoJAs9XI xh9caFWkJ9fo2IuEAUegbuMdDkOs8n84K/mzMZlyV33TjNIk8zJG3uxXkPwyeBI4MiXm whRg3vrT9VzXbCaGpjxWxZIVqM1iquE+aSGYHyh2Hy/uKJ84sseEiq+yki8ggXzTx4DE 3yQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Dg5JNA6G; 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 si7si18109095ejb.5.2020.12.27.22.24.45; Sun, 27 Dec 2020 22:25:23 -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=@google.com header.s=20161025 header.b=Dg5JNA6G; 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 S1727857AbgL1GXX (ORCPT + 99 others); Mon, 28 Dec 2020 01:23:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726511AbgL1GXW (ORCPT ); Mon, 28 Dec 2020 01:23:22 -0500 Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EEC6C061794 for ; Sun, 27 Dec 2020 22:22:42 -0800 (PST) Received: by mail-pg1-x54a.google.com with SMTP id m23so7550063pgl.6 for ; Sun, 27 Dec 2020 22:22:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=G8mTuI59vHARrWXenok3n0BrbeW6B94jcY14Tht2HbY=; b=Dg5JNA6Gc8fQ6TeLqfivSU/ryWRvkFcfsojppNO/3b14rKilcUJe5scJJ2WhrqoNTy rhds1HXsknt65hwGWh7ag31ycIz3XY0B5iYn6bUrXhN4Pq1p16MTzVIgdW5is7jBjmXQ h9OtKSicLoNxiFbO0GSTCUJq2NNT1ZyrcqENeY2zWrCR6ZtlCsXD9GstWX5OuSAxE93z fRlZDmuuf7kHJk6d1q1eQ1cXsV39C7YzFlBToSdKYFaNe1uhuY435r1wAX/VwiI3XIN2 Vg4zP9NH5VDaxf2enzYNs7VqUBDIJB9HVsRsEA2wMbmNOrW7crap32X8HlnhfwAjSj77 TEqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=G8mTuI59vHARrWXenok3n0BrbeW6B94jcY14Tht2HbY=; b=phMPl5H64BV0DQw2MJ8VNLsuypLHsaCfOl50xcZCkTrZ73DX+0D3n1B6RMOJIKUeYK p0SPUJEn3DMsTAm7zV4+UkyT94cMsvTZEdCEDHqiMsfaWWLlmLYcjHlapSFt9Q+6/Nhz GRPrpMzSRY2cENedDyC62HgXejvBPOeaUwj5DRlfSl7bkVZMx1dkrZ2d90HvPm9P9glN +kXjcLHAQQc2cfH1PQU/+dKzrj/+xw9pMfvd8I+Yye8E67i7jXLVuUF4PGefEFM9/9Yg OIzLCV47zik7kv/mY4UcC+deGR8kXX8TkV41hYKInqyVdI3JZiRgyO1ULP0eUXCR3ry4 GEVA== X-Gm-Message-State: AOAM530OWZhEFPGjlugIlJPUkA0+HyA4K/G/ExoP8SARNJNSXJLscYsY kJJUMaggld9cEngNSfKpqGsNAUZ1pfWaVDRh5wwpnYVVZQCH9IPKAWfpkc1DfAsL12sOaaVv+7j J/8TzxKzL46c4s+rRI9fUG/QEli33zh2rGzIiw+u8grH1o3MvRmOGEqZ0UttxKLwCr5ARPGGZGq c5I860FT10nYo= Sender: "howardchung via sendgmr" X-Received: from howardchung-p920.tpe.corp.google.com ([2401:fa00:1:10:f693:9fff:fef4:4e45]) (user=howardchung job=sendgmr) by 2002:a17:90a:8b94:: with SMTP id z20mr1967093pjn.1.1609136561606; Sun, 27 Dec 2020 22:22:41 -0800 (PST) Date: Mon, 28 Dec 2020 14:22:36 +0800 Message-Id: <20201228142224.Bluez.v1.1.I89c3c683e3dec6439f3b0d2c00da86a2107019af@changeid> Mime-Version: 1.0 X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog Subject: [Bluez PATCH v1] shared/gatt-client: Fix GATT client attribute read with offset From: Howard Chung To: linux-bluetooth@vger.kernel.org, luiz.dentz@gmail.com Cc: sonnysasaka@chromium.org, alainm@chromium.org, Howard Chung Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org bluez always replies the whole value despite a user specify the offset. This patch fixes the issue. Reviewed-by: sonnysasaka@chromium.org --- src/gatt-client.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gatt-client.c b/src/gatt-client.c index 0cf5324ffa46..bec6e1ec049e 100644 --- a/src/gatt-client.c +++ b/src/gatt-client.c @@ -368,7 +368,8 @@ static void desc_read_cb(bool success, uint8_t att_ecode, } /* Read the stored data from db */ - if (!gatt_db_attribute_read(desc->attr, 0, 0, NULL, read_op_cb, op)) { + if (!gatt_db_attribute_read(desc->attr, op->offset, 0, NULL, read_op_cb, + op)) { error("Failed to read database"); att_ecode = BT_ATT_ERROR_UNLIKELY; goto fail; @@ -906,7 +907,8 @@ static void chrc_read_cb(bool success, uint8_t att_ecode, const uint8_t *value, } /* Read the stored data from db */ - if (!gatt_db_attribute_read(chrc->attr, 0, 0, NULL, read_op_cb, op)) { + if (!gatt_db_attribute_read(chrc->attr, op->offset, 0, NULL, read_op_cb, + op)) { error("Failed to read database"); att_ecode = BT_ATT_ERROR_UNLIKELY; goto fail; -- 2.29.2.729.g45daf8777d-goog