Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp136701ybl; Tue, 7 Jan 2020 15:45:09 -0800 (PST) X-Google-Smtp-Source: APXvYqwAS+tm/IE0KrHVwUm/kEpG1/87BEomtJwMjrSzuDKccEtziDkHpwt1i44t6LhO12VGiFKT X-Received: by 2002:a05:6808:2ce:: with SMTP id a14mr869400oid.82.1578440709313; Tue, 07 Jan 2020 15:45:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578440709; cv=none; d=google.com; s=arc-20160816; b=maYRgWTrVMaieDwqW7oWuWuWfcs2odr9h0bTAZlri9ViQf1LY5OEEQISWwiwNjtoNT /bNr0mF998rdsUgcxKdkqJHlYEofbD52aS398JnijSXlXK49mXfajYY+CV+4Y7MvRXOA rmNdFhVy4K+4/hjVzb7CKQ/ZKlPiv5Qu5SfEVuIQZ7JdxgNJNyOpgGKX+Ir1GRR5VMCM h506e2kLopcayR9mfSc24G7g32BSCsoJa2fLF8Jy2GEJqt4E6akUfgVdvYdeZa/wqQcU ZQeuPq4EPvHkWZm18BtAdbQwdZfqhKzJoDAqx4YgoXk2TaRJeDSouf2Huf767u/XjPXk z3rw== 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=26Hs7bL3la0QaOPsspnfrAtVAW15s68Yo0RPHDwP+IE=; b=Qcch17lnA8Nk7KE8jbE2fd3I2vGDwHRjlPsCYQkykdoSqmZbgVGD4oJvCn8aauKXex 2JngYx1LqMd9Ctm3y/iuGgOx0ub/y27s02m1K+vu/mq12wBQOlri/a1zP4MRxXCnTAFZ OCs7ofBJ4CM5n6YJsyBj+dGdRWQBiuwFEkKLQ98Z+jc0AxSPPxmwlRO9VYh4jx1pvRKI icNHY19DZOmx7zI/6GYhBxGIlD3cvnBRIH/PvacGbUR0jk75x8skuFJG92FatkIQa9Ti J/+OlXpNPlj2stzxjau4Pled5EQ3PNIoQYCQ9K4Qp4lCenksNl67ZHTlVNc3ts03Canv SifA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lk34hNPz; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j5si772799oii.114.2020.01.07.15.44.37; Tue, 07 Jan 2020 15:45:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lk34hNPz; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 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 S1726932AbgAGXn5 (ORCPT + 99 others); Tue, 7 Jan 2020 18:43:57 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:42755 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726530AbgAGXn5 (ORCPT ); Tue, 7 Jan 2020 18:43:57 -0500 Received: by mail-ot1-f68.google.com with SMTP id 66so1784020otd.9 for ; Tue, 07 Jan 2020 15:43:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=26Hs7bL3la0QaOPsspnfrAtVAW15s68Yo0RPHDwP+IE=; b=lk34hNPzDQ6G9emfUTyvjanAmbtVeSSE5GNPZmMaphYp0GfGvsdX51YZ6l0ZkU/bmE fqMbMGvTd37WW7Bl7tugBbF65AE4TEG1c3yFh1nnN7MPdS/AeErzC2AvharTwYf8dSiM u1mgzmhcvfe2gT7wIWF56kah56f9kEj5bUNOwScclCWTRGAqmECRDpmnyXvMSXvdQHSe 3ZNqa9nI9m6iEnTBtIBKZ44Us4CgduLhOyDZbhamN1b44vw7gTLwS2QG3MsZy4hHQ4Ln MbTEgxC50pTEdHHA1HB/89Vlol6MW84oMZu8USbQec2hIovSD4b60BgOz6Ed3NLJukCR UcMw== 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=26Hs7bL3la0QaOPsspnfrAtVAW15s68Yo0RPHDwP+IE=; b=sFiX+WZAcv3hmkNYfa6AWkpnZNtX3ZIxPJqDkHFLs5txgPQqLLSZ8GCU+mCW8+Yat4 mlZJ+eNfJskPMSUx6Qp92QuScLJCgBWieKe2kgHBWx6ZSGfVh9y1ZhBI+WMu4uzjm0hV 3N3rG5DY4M4qkIrXtm2BCPDSLHyrNhnVbpDpvZI+HjB5ybmfjRcz1MV9e311ukAToZoS k6WaC48Iz+xen8ZFRytMglv/BCAY/bHczrlZQgxb9CO8nVHA2WXPrzSfq4ScZPzum5Ds dqv3YKAhGxTjIiYygK5V3GJQfq60qbhH6FnkadhxAYYL+2dbOBCA0HCwisvR7ANifUV1 10aA== X-Gm-Message-State: APjAAAUegw68MW19PZEW9dTi3bJwv7Y4mgbXOukHLpenJRd5Gs7xtwjK kTRLRnbedT1oX9vrDpN6Bu3bOih4eXKBB8YBVVPFd+9v X-Received: by 2002:a9d:5542:: with SMTP id h2mr2020458oti.146.1578440636815; Tue, 07 Jan 2020 15:43:56 -0800 (PST) MIME-Version: 1.0 References: <20200107091833.14921-1-szymon.czapracki@codecoup.pl> <20200107091833.14921-2-szymon.czapracki@codecoup.pl> In-Reply-To: <20200107091833.14921-2-szymon.czapracki@codecoup.pl> From: Luiz Augusto von Dentz Date: Tue, 7 Jan 2020 15:43:44 -0800 Message-ID: Subject: Re: [PATCH 2/8] monitor: Decode LE Periodic Advertising Sync Transfer Received Event To: Szymon Czapracki Cc: "linux-bluetooth@vger.kernel.org" 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 Hi Szymon, On Tue, Jan 7, 2020 at 1:20 AM Szymon Czapracki wrote: > > Change-Id: I5a7c2d36ca5aee61441c2aab6adeb16058ab062f > --- > monitor/bt.h | 14 ++++++++++++++ > monitor/packet.c | 27 +++++++++++++++++++++++++++ > 2 files changed, 41 insertions(+) > > diff --git a/monitor/bt.h b/monitor/bt.h > index ecf3782c9..e14c1771f 100644 > --- a/monitor/bt.h > +++ b/monitor/bt.h > @@ -3140,6 +3140,20 @@ struct bt_hci_evt_le_chan_select_alg { > uint8_t algorithm; > } __attribute__ ((packed)); > > +#define BT_HCI_EVT_LE_PER_ADV_SYNC_TRANS_REC 0x18 > +struct bt_hci_evt_le_per_adv_sync_trans_rec { > + uint8_t status; > + uint16_t handle; > + uint16_t service_data; > + uint16_t sync_handle; > + uint8_t sid; > + uint8_t addr_type; > + uint8_t addr[6]; > + uint8_t phy; > + uint16_t interval; > + uint8_t clock_accuracy; > +} __attribute__ ((packed)); > + > #define BT_HCI_ERR_SUCCESS 0x00 > #define BT_HCI_ERR_UNKNOWN_COMMAND 0x01 > #define BT_HCI_ERR_UNKNOWN_CONN_ID 0x02 > diff --git a/monitor/packet.c b/monitor/packet.c > index 64f75cf8e..76bb9f239 100644 > --- a/monitor/packet.c > +++ b/monitor/packet.c > @@ -600,6 +600,12 @@ static void print_addr_type(const char *label, uint8_t addr_type) > case 0x01: > str = "Random"; > break; > + case 0x02: > + str = "Public Identity Address"; > + break; > + case 0x03: > + str = "Random Identity Address"; > + break; Usually the term Address is already part of the label so we don't need to repeat here, Random Identity also doesn't sound right, it should probably be Static Random or perhaps have Resolved Public and Resolved Static Random to indicate they are actually resolved address from RPA. > default: > str = "Reserved"; > break; > @@ -9788,6 +9794,24 @@ static void le_chan_select_alg_evt(const void *data, uint8_t size) > print_field("Algorithm: %s (0x%2.2x)", str, evt->algorithm); > } > > +static void le_per_adv_sync_trans_rec_evt(const void *data, uint8_t size) > +{ > + const struct bt_hci_evt_le_per_adv_sync_trans_rec *evt = data; > + > + print_status(evt->status); > + print_field("Handle: %d", evt->handle); > + print_field("Connection handle: %d", evt->handle); > + print_field("Service data: 0x%4.4x", evt->service_data); > + print_field("Sync handle: %d", evt->sync_handle); > + print_field("SID: 0x%2.2x", evt->sid); > + print_addr_type("Address type:", evt->addr_type); > + print_addr("Addres:", evt->addr, evt->addr_type); > + print_le_phy("PHY:", evt->phy); > + print_field("Periodic advertising Interval: %.3f", > + 1.25 * evt->interval); > + print_clock_accuracy(evt->clock_accuracy); > +} > + > struct subevent_data { > uint8_t subevent; > const char *str; > @@ -9871,6 +9895,9 @@ static const struct subevent_data le_meta_event_table[] = { > le_scan_req_received_evt, 8, true}, > { 0x14, "LE Channel Selection Algorithm", > le_chan_select_alg_evt, 3, true}, > + { 0x18, "LE Periodic Advertising Sync Transfer Received", > + le_per_adv_sync_trans_rec_evt, 19, > + true}, > { } > }; > > -- > 2.24.1 > -- Luiz Augusto von Dentz