Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp561042ybl; Wed, 8 Jan 2020 02:00:32 -0800 (PST) X-Google-Smtp-Source: APXvYqxwmMS1qDwdM31khZ3OrbKnbc6zTwgZQum1NCa9Iv3AfDkXUYHFHiqHeXeKDlmmyKwIss1X X-Received: by 2002:a9d:774e:: with SMTP id t14mr3502373otl.358.1578477632507; Wed, 08 Jan 2020 02:00:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578477632; cv=none; d=google.com; s=arc-20160816; b=wjlApFk0VBhC5UFcTpdsqkBzpkkzV1eFz8ussAJMNLokqdn3zK97Cj+WudWYsDkJ9U 7wAycVUDY0X88mqTOXaLm75e3Mx/5nF33X/xsHSBLYk+cTWRaVpyD9TpGlYwow7y4tNR 4GXXm2JU5uPoqlNRqoMPMnIpAXDSDPmXNOCXStanpjWsx56hneE9n85bGEQi4YRNuBz5 d0pynVjwkc+0DnHYqRkDxpbm6WFOzOz7aLwDsS5UHsCw5iY973EkPMaq6ucwl1XHw6Fc J3pDYQuqba69EdJUiojb/HjHi7Fp9rS3fhyryy1G/LMI3LsG/rPMIB5O7SxKgVNkPQwL ZoPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature; bh=zzbFEiJ9y/McpMzwIwIERcTp9NMkNWUdv9x47+Y/Joo=; b=Qlq97E8I2jB+tThVfgtUgpb3Q26jojiPEwCxuKyGaxm1sJAzTfC6EGXth91G2SejTd NLo5eMickqsVrkga1F/g3nSo0C2TpM/aoOmHeZ4MXXQPphNqjkwU+nujHfnPvN4A5vyg xJYi6rlXWZNmD8IHI8uktmBkm74EiXtZYmDUd7hm8ol5lM8Od2z/EQC1a3qr8d7h6Hv/ +xF6bTqFnndXUQqomd1GlaPUosrEe6fittbNMMmaqwKBFc3QngUelRRGFyBgFUUc8uLa c7t7khrexaKhHeWCFIVkwW8mwXYJ3IZSk5yHQo30k04v3WhAg5Z1WrZYXd2PvOsIuCgJ nEgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codecoup-pl.20150623.gappssmtp.com header.s=20150623 header.b=ph7q4sgK; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f189si1594623oib.268.2020.01.08.02.00.07; Wed, 08 Jan 2020 02:00:32 -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=@codecoup-pl.20150623.gappssmtp.com header.s=20150623 header.b=ph7q4sgK; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726087AbgAHJxU (ORCPT + 99 others); Wed, 8 Jan 2020 04:53:20 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:41192 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726368AbgAHJxT (ORCPT ); Wed, 8 Jan 2020 04:53:19 -0500 Received: by mail-lj1-f195.google.com with SMTP id h23so2631626ljc.8 for ; Wed, 08 Jan 2020 01:53:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codecoup-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:in-reply-to :references:mime-version:content-transfer-encoding; bh=zzbFEiJ9y/McpMzwIwIERcTp9NMkNWUdv9x47+Y/Joo=; b=ph7q4sgKkwVsMW6Y3+9F0cjG1opJBpLgAhjOOQPqhO5gaedzBP97So8JxkHxiw3jrG 6UhxYyUo5nB/0A2AcQ6gTrYy3SeG1TBlnmKI6RFLa1bcItgKOVuDUp9gFv5UTQlbchCY +lCMS4VDdV3SuU8EzaWtML+0IDMF4K6o2w1TrVTfqQrUcbqR2FNsgNStrrOVZ+SzXgod GYMwuzq2PEV8yXAgiJFU3nBCRNo4PY14RLBBwPBW2JYuPQ1VBPErTX8QZLEaD5fNAi91 T2K9Ttukg4Yzs/SLGeoqkwiNHDDV/MEzj6YDy2Gpan5P0eHHlUwSPR3kCSPYCeW83YuZ Q8/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :in-reply-to:references:mime-version:content-transfer-encoding; bh=zzbFEiJ9y/McpMzwIwIERcTp9NMkNWUdv9x47+Y/Joo=; b=cKY2HquDxT9IFwcM9GA0dM/i44MuL9ntG9gqj4zDRn/I3U2vPSKhpw+N2NE7EdGmKl 25Obiv6oSApltoeZXKzH4wDat2S0saCJkg7OMQgUhBgRDjzD/L4vXcoygiBYOIhZqAjQ 5lZ6MYMjFRG6BSXvj4o9xn3o/qPYMPL1Bzlg8H02fVPlEZj23rVEu9uJOTui/6Yv9+2Y pSHdeP9TFOBBKkMM3e46GXxN9RuldWYiAtiPOXPWSbSmEUvuoO8quor9WrkCVZhhmFxi IOlyj/zV06tk2guvjov/4bzm/AJdo7YBmwLycMK5RdsoLXZYUGhEmq3wqX5PE0aKRr/I PSpQ== X-Gm-Message-State: APjAAAW3eUcEogDfVsF49WiUmJJaUspiZ7X8DJ0ITn5o2Wbw5d+FYjlT Cg9cOotOhUAB9Gb3gvzQ/dQ77Q== X-Received: by 2002:a2e:8755:: with SMTP id q21mr2462447ljj.156.1578477196383; Wed, 08 Jan 2020 01:53:16 -0800 (PST) Received: from ix.localnet ([95.143.243.62]) by smtp.gmail.com with ESMTPSA id u24sm961456ljo.77.2020.01.08.01.53.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2020 01:53:15 -0800 (PST) From: Szymon Janc To: Luiz Augusto von Dentz Cc: Szymon Czapracki , "linux-bluetooth@vger.kernel.org" Subject: Re: [PATCH 2/8] monitor: Decode LE Periodic Advertising Sync Transfer Received Event Date: Wed, 08 Jan 2020 10:53:14 +0100 Message-ID: <1770049.2qRCXdMzth@ix> Organization: CODECOUP In-Reply-To: References: <20200107091833.14921-1-szymon.czapracki@codecoup.pl> <20200107091833.14921-2-szymon.czapracki@codecoup.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi, On Wednesday, 8 January 2020 00:43:44 CET Luiz Augusto von Dentz wrote: > 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. Those names are from spec actually but I agree that those are somewhat odd. How about just using print_peer_addr_type() to print this? Then we have: public, random, resolved public and resolved Random. This is short and also makes output consistent with other events. > > > 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 -- pozdrawiam Szymon Janc