Re: [PATCH 1/3] monitor: Decode LE Periodic Advertising Sync Established Event

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Szymon,

On Wed, May 22, 2019 at 12:26 PM Szymon Janc <szymon.janc@xxxxxxxxxxx> wrote:
>
> > HCI Event: LE Meta Event (0x3e) plen 16                                                                                                                                                             #976 [hci1] 607.133703
>       LE Periodic Advertising Sync Established (0x0e)
>         Status: Success (0x00)
>         Sync handle: 0
>         Advertising SID: 0x06
>         Advertiser address type: Random (0x01)
>         Advertiser address: FF:00:00:00:00:AA (Static)
>         Advertiser PHY: LE 1M (0x01)
>         Periodic advertising invteral: 50.00 msec (0x0028)
>         Advertiser clock accuracy: 0x04
> ---
>  monitor/bt.h     | 12 ++++++++++++
>  monitor/packet.c | 21 ++++++++++++++++++++-
>  2 files changed, 32 insertions(+), 1 deletion(-)
>
> diff --git a/monitor/bt.h b/monitor/bt.h
> index d32d3a153..6494c928f 100644
> --- a/monitor/bt.h
> +++ b/monitor/bt.h
> @@ -3091,6 +3091,18 @@ struct bt_hci_le_ext_adv_report {
>         uint8_t  data[0];
>  } __attribute__ ((packed));
>
> +#define BT_HCI_EVT_LE_PER_SYNC_ESTABLISHED     0x0e
> +struct bt_hci_evt_le_per_sync_established {
> +       uint8_t  status;
> +       uint16_t 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_EVT_LE_ADV_SET_TERM             0x12
>  struct bt_hci_evt_le_adv_set_term {
>         uint8_t  status;
> diff --git a/monitor/packet.c b/monitor/packet.c
> index 30d432316..3235ad004 100644
> --- a/monitor/packet.c
> +++ b/monitor/packet.c
> @@ -9613,6 +9613,24 @@ static void le_ext_adv_report_evt(const void *data, uint8_t size)
>         }
>  }
>
> +static void le_per_adv_sync(const void *data, uint8_t size)
> +{
> +       const struct bt_hci_evt_le_per_sync_established *evt = data;
> +
> +       print_status(evt->status);
> +       print_field("Sync handle: %d", evt->handle);
> +       if (evt->sid > 0x0f)
> +               print_field("Advertising SID: Reserved (0x%2.2x)", evt->sid);
> +       else
> +               print_field("Advertising SID: 0x%2.2x", evt->sid);
> +
> +       print_peer_addr_type("Advertiser address type", evt->addr_type);
> +       print_addr("Advertiser address", evt->addr, evt->addr_type);
> +       print_le_phy("Advertiser PHY", evt->phy);
> +       print_slot_125("Periodic advertising invteral", evt->interval);
> +       print_field("Advertiser clock accuracy: 0x%2.2x", evt->clock_accuracy);
> +}
> +
>  static void le_adv_set_term_evt(const void *data, uint8_t size)
>  {
>         const struct bt_hci_evt_le_adv_set_term *evt = data;
> @@ -9726,7 +9744,8 @@ static const struct subevent_data le_meta_event_table[] = {
>                                 le_phy_update_complete_evt, 5, true},
>         { 0x0d, "LE Extended Advertising Report",
>                                 le_ext_adv_report_evt, 1, false},
> -       { 0x0e, "LE Periodic Advertising Sync Established" },
> +       { 0x0e, "LE Periodic Advertising Sync Established",
> +                               le_per_adv_sync, 15, true },
>         { 0x0f, "LE Periodic Advertising Report" },
>         { 0x10, "LE Periodic Advertising Sync Lost" },
>         { 0x11, "LE Scan Timeout" },
> --
> 2.20.1

Applied, thanks.

-- 
Luiz Augusto von Dentz



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux