Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1936288iog; Thu, 16 Jun 2022 17:54:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v8nJRjX/Fi5WCzJoVYCnxmOf5lczZuoUD5jqplZh8oH5gB18PgrUsNWjQUgEEuXcVDQZuc X-Received: by 2002:a63:794d:0:b0:40c:450e:b0e1 with SMTP id u74-20020a63794d000000b0040c450eb0e1mr2208920pgc.531.1655427266116; Thu, 16 Jun 2022 17:54:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655427266; cv=none; d=google.com; s=arc-20160816; b=j+DTlgK0utbYRWeUPo8xGIkZ/jLrAEgHLhWRC6suv/gNfiHm/J+HksJ2DGqc/eDoRf 2yDnyIHgUKkjkOf9NuRbjgsH1gsBm3K/Wf6PUoFqVPO9IldX9QlyzWbWvbTkJcLPL6ah RUNyVVLfSvlE8kwNyjAlw126TY6P9QWICA0dz96aqQf69T8DQjQ6Zyvy/DUcQdz1IKhs 3Juee7tugQdE6mLXUOQ9bBla+fVovogePdali1EOgSQQSm0gjS14jbjhUJLOBX+k8f+3 ZVdJB8BDTcdobH3L+DQinptgwxgOle25y/yuUtDaqzUBKSZVcOdqRpMUbvIVhTliCrMe AcQg== 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=G9oieWRgAMAuM4l/LZD5hLljgu0Jll3/4JXTYS8AOqs=; b=zoKSNvifksSAxgdHcZLlWwWBiVUQyGClCps29dkW5AkUMyRu+XVk/6oHEvDegf1I45 AduRImCOF487Em43vWdtpVWHRGS2iICRk4ZTpzNxHEW9UNEn+8Cq9zr3R735gMSoWgSr s6Cpjd4INa3LNVDVxTGVqN3LWoXy1pY//JtxwkhdYxYyKQJoBCUtcO4qNuht49QC+RD/ 3EIWcxXpJvkqrAPKqfnKpQZRrOhe2+EdzkuCYyWjj8PxV9pBdusTz2X+oeW1NmfK5Q7v h2O0MWqoV0hxZtsYRQiC89B+PNcXRpV4QeQs/m2NEWkYKHHKut8F5NtVQAuXNTScfoxF aq6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KDuXlmBR; 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 s9-20020a17090b070900b001cbbd85faa9si7309667pjz.20.2022.06.16.17.53.57; Thu, 16 Jun 2022 17:54:26 -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=KDuXlmBR; 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 S232733AbiFQAuC (ORCPT + 99 others); Thu, 16 Jun 2022 20:50:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbiFQAuB (ORCPT ); Thu, 16 Jun 2022 20:50:01 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39B2F61636 for ; Thu, 16 Jun 2022 17:50:00 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id b12-20020a17090a6acc00b001ec2b181c98so1644292pjm.4 for ; Thu, 16 Jun 2022 17:50:00 -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=G9oieWRgAMAuM4l/LZD5hLljgu0Jll3/4JXTYS8AOqs=; b=KDuXlmBRKFQLY+EP+L+C+EVf/tP92F17XG3lO3/AnGA0gyOnvbuphQ1V0v+aqqXtoa cnclYGryu1oN/ELK4gzT/+4WEO+paLvyP8z2lAcrw4sX4IP2zkNaCZ0kXvcYTnOumk/P IKt5I7bIAX4oCKutCXtfVgC0LUZ5xOwZbqhq/C8uIU31GUwxmtpX31bQYthmv4rjDHmD LF1TjqAyO0uTTL4N9Pfv9yckAA8AByCpda56uZNGUghHfKhYNe4gMktW3hf6mb2uq0q+ yp0Tdcesk/HF6cUxDiEgPT+rwfpp5/nRPj/jGXnhoU69a0hX6GgQRA382D1K9Ca4T1wI 3vQg== 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=G9oieWRgAMAuM4l/LZD5hLljgu0Jll3/4JXTYS8AOqs=; b=flauQHTP1trNnldcVLWzpNbW+DqegQ4XxZhNtY/zBLEktUJt5CxrZ7sYh+f2E8MpAx JrVVkFJeblA+vjfwf2L8pUE2q8SarXTQbVt9lR6kXkBhveUyIpCE59w1Jpc2m6K7BmB4 Z/2WKd3q3cVZ7fw6jT05Boxm8MvUjWfQ4Eg3WcnUhvjZ5cU6RIt3n8EYGSxHxnJ2cWZV p+eiPY9HJb12tBna7koZqBvm3W+4NOhyl7lK4Ho8pxr0Up4GGCzWlpqbfGCKCtXPQaQI kGIVI8/bkXQm/pNp4z3XDMGnBRO2aNuklQ2+l/tOe7KJWK8Ipxlz/n0CpQUmFTLJbxS9 bJgQ== X-Gm-Message-State: AJIora++rW4DHk9WcZtVtVRus5i4382WL1U6qVlcO76JH1FESbVz9t9t +UEO4D3YyX6PQa/yx4F3XP9TLYsHELQ= X-Received: by 2002:a17:902:728d:b0:168:d0cf:2246 with SMTP id d13-20020a170902728d00b00168d0cf2246mr6947778pll.74.1655426999174; Thu, 16 Jun 2022 17:49:59 -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 u23-20020a170902a61700b0015e8d4eb25asm338996plq.164.2022.06.16.17.49.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 17:49:58 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 1/4] monitor/att: Print attribute information on ATT_REQ_RSP Date: Thu, 16 Jun 2022 17:49:54 -0700 Message-Id: <20220617004957.1148939-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.35.3 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 This prints the attribute information on ATT_REQ_RSP to make it easier to identify to which handle the response is for: > ACL Data RX: Handle 42 flags 0x02 dlen 9 Channel: 65 len 5 sdu 3 [PSM 39 mode Enhanced Credit (0x81)] {chan 1} ATT: Read Response (0x0b) len 2 Value: 0300 Handle: 0x0030 Type: Source ASE (0x2bc5) ASE ID: 3 State: Idle (0x00) --- monitor/att.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/monitor/att.c b/monitor/att.c index de70a9dc4..34babac6b 100644 --- a/monitor/att.c +++ b/monitor/att.c @@ -1290,17 +1290,12 @@ static struct gatt_db_attribute *get_attribute(const struct l2cap_frame *frame, return gatt_db_get_attribute(db, handle); } -static void print_handle(const struct l2cap_frame *frame, uint16_t handle, - bool rsp) +static void print_attribute(struct gatt_db_attribute *attr) { - struct gatt_db_attribute *attr; + uint16_t handle = gatt_db_attribute_get_handle(attr); const bt_uuid_t *uuid; char label[21]; - attr = get_attribute(frame, handle, rsp); - if (!attr) - goto done; - uuid = gatt_db_attribute_get_type(attr); if (!uuid) goto done; @@ -1323,6 +1318,20 @@ done: print_field("Handle: 0x%4.4x", handle); } +static void print_handle(const struct l2cap_frame *frame, uint16_t handle, + bool rsp) +{ + struct gatt_db_attribute *attr; + + attr = get_attribute(frame, handle, rsp); + if (!attr) { + print_field("Handle: 0x%4.4x", handle); + return; + } + + print_attribute(attr); +} + static void att_read_req(const struct l2cap_frame *frame) { const struct bt_l2cap_att_read_req *pdu = frame->data; @@ -1393,6 +1402,8 @@ static void att_read_rsp(const struct l2cap_frame *frame) if (!read) return; + print_attribute(read->attr); + read->func(frame); free(read); -- 2.35.3