From dc162344e1e09eb8e6b851cb0ebec4e6652f3102 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 27 Feb 2019 13:12:27 +0200 Subject: [PATCH] monitor: Decode LL_PERIODIC_SYNC_IND This introduces the command passing for LL_PERIODIC_SYNC_IND PDU added in 5.1. Change-Id: I6bbc4ef6107c3bf0045ef3427458bacfec95ea92 Signed-off-by: himanshu --- monitor/bt.h | 12 ++++++++++++ monitor/ll.c | 25 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/monitor/bt.h b/monitor/bt.h index f3995b4..3b2af74 100755 --- a/monitor/bt.h +++ b/monitor/bt.h @@ -156,6 +156,18 @@ struct bt_ll_cte_req { #define BT_LL_CTE_RSP 0x1b +#define BT_LL_PERIODIC_SYNC_IND 0x1c +struct bt_ll_periodic_sync_ind { + uint16_t id; + uint8_t info[18]; + uint16_t event_count; + uint16_t last_counter; + uint8_t adv_info; + uint8_t phy; + uint8_t adv_addr[6]; + uint16_t sync_counter; +} __attribute__ ((packed)); + #define LMP_ESC4(x) ((127 << 8) | (x)) #define BT_LMP_NAME_REQ 1 diff --git a/monitor/ll.c b/monitor/ll.c index fdfea42..2378218 100755 --- a/monitor/ll.c +++ b/monitor/ll.c @@ -569,6 +569,30 @@ static void cte_req(const void *data, uint8_t size) } } +static void periodic_sync_ind(const void *data, uint8_t size) +{ + const struct bt_ll_periodic_sync_ind *pdu = data; + uint8_t mask; + + print_field("ID: 0x%4.4x", pdu->id); + print_field("SyncInfo:"); + packet_hexdump(pdu->info, sizeof(pdu->info)); + print_field("connEventCount: 0x%4.4x", pdu->event_count); + print_field("lastPaEventCounter: 0x%4.4x", pdu->last_counter); + print_field("SID: 0x%2.2x", pdu->adv_info & 0xf0); + print_field("AType: %s", pdu->adv_info & 0x08 ? "random" : "public"); + print_field("SCA: 0x%2.2x", pdu->adv_info & 0x07); + print_field("PHY: 0x%2.2x", pdu->phy); + + mask = print_bitfield(2, pdu->phy, le_phys); + if (mask) + print_text(COLOR_UNKNOWN_OPTIONS_BIT, " Reserved" + " (0x%2.2x)", mask); + + packet_print_addr("AdvA", pdu->adv_addr, pdu->adv_info & 0x08); + print_field("syncConnEventCount: 0x%4.4x", pdu->sync_counter); +} + struct llcp_data { uint8_t opcode; const char *str; @@ -606,6 +630,7 @@ static const struct llcp_data llcp_table[] = { { 0x19, "LL_MIN_USED_CHANNELS_IND", min_used_channels, 2, true }, { 0x1a, "LL_CTE_REQ", cte_req, 1, true }, { 0x1b, "LL_CTE_RSP", null_pdu, 0, true }, + { 0x1c, "LL_PERIODIC_SYNC_IND", periodic_sync_ind, 34, true }, { } }; -- 2.7.4