monitor: Add decoding support for LL_LENGTH_*
Luiz Augusto von Dentz
maintainerPATCH 1/7 monitor: Add decoding support for LL_LENGTH_*
From: Luiz Augusto von Dentz <[email protected]>
This prints makes the fields to be printed instead of just decoding the PDU name.
--- monitor/bt.h | 6 ++++++ monitor/ll.c | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-)
monitor/bt.h +6 -0
@@ -119,6 +119,12 @@ struct bt_ll_reject_ind_ext {#define BT_LL_PING_RSP 0x13#define BT_LL_LENGTH_REQ 0x14 +struct bt_ll_length { +uint16_t rx_len; +uint16_t rx_time; +uint16_t tx_len; +uint16_t tx_time; +} __attribute__ ((packed));#define BT_LL_LENGTH_RSP 0x15
monitor/ll.c +12 -2
@@ -476,6 +476,16 @@ static void reject_ind_ext(const void *data, uint8_t size)packet_print_error ("Error code" , pdu->error); } +static void length_req_rsp (const void *data,uint8_t size) +{ +const struct bt_ll_length *pdu = data; + +print_field ("MaxRxOctets: %u" , pdu->rx_len); +print_field ("MaxRxTime: %u" , pdu->rx_time); +print_field ("MaxTxOctets: %u" , pdu->tx_len); +print_field ("MaxtxTime: %u" , pdu->tx_time); +} +struct llcp_data {uint8_t opcode;const char *str;
@@ -505,8 +515,8 @@ static const struct llcp_data llcp_table[] = { { 0x11, "LL_REJECT_IND_EXT", reject_ind_ext, 2, true }, { 0x12, "LL_PING_REQ", null_pdu, 0, true }, { 0x13, "LL_PING_RSP", null_pdu, 0, true }, - { 0x14, "LL_LENGTH_REQ", NULL, 8, true }, - { 0x15, "LL_LENGTH_RSP", NULL, 8, true }, + { 0x14, "LL_LENGTH_REQ", length_req_rsp, 8, true }, + { 0x15, "LL_LENGTH_RSP", length_req_rsp, 8, true }, { 0x16, "LL_PHY_REQ", NULL, 2, true }, { 0x17, "LL_PHY_RSP", NULL, 2, true }, { 0x18, "LL_PHY_UPDATE_IND", NULL, 4, true },
Signature · 1 line
2.17.2
Luiz Augusto von Dentz
maintainerPATCH 2/7 monitor: Add decoding support for LL_PHY_*
From: Luiz Augusto von Dentz <[email protected]>
This prints makes the fields to be printed instead of just decoding the PDU name.
--- monitor/bt.h | 8 ++++++++ monitor/ll.c | 31 +++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-)
monitor/bt.h +8 -0
@@ -128,6 +128,14 @@ struct bt_ll_length {#define BT_LL_LENGTH_RSP 0x15 +#define BT_LL_PHY_REQ 0x16 +struct bt_ll_phy { +uint8_t tx_phys; +uint8_t rx_phys; +} __attribute__ ((packed)); + +#define BT_LL_PHY_RSP 0x17 +#define LMP_ESC4 (x) ((127 << 8) | (x))#define BT_LMP_NAME_REQ 1
monitor/ll.c +29 -2
@@ -39,6 +39,7 @@#define COLOR_OPCODE COLOR_MAGENTA#define COLOR_OPCODE_UNKNOWN COLOR_WHITE_BG +#define COLOR_UNKNOWN_OPTIONS_BIT COLOR_WHITE_BG#define MAX_CHANNEL 16
@@ -486,6 +487,32 @@ static void length_req_rsp(const void *data, uint8_t size)print_field ("MaxtxTime: %u" , pdu->tx_time); } +static const struct bitfield_data le_phys[] = { + {0 ,"LE 1M" }, + {1 ,"LE 2M" }, + {2 ,"LE Coded" }, + { } +}; + +static void phy_req_rsp (const void *data,uint8_t size) +{ +const struct bt_ll_phy *pdu = data; +uint8_t mask; + +print_field ("RX PHYs: 0x%2.2x" , pdu->rx_phys); + + mask =print_bitfield (2 , pdu->rx_phys, le_phys); +if (mask) +print_text (COLOR_UNKNOWN_OPTIONS_BIT ," Reserved" +" (0x%2.2x)" , mask); +print_field ("TX PHYs: 0x%2.2x" , pdu->tx_phys); + + mask =print_bitfield (2 , pdu->tx_phys, le_phys); +if (mask) +print_text (COLOR_UNKNOWN_OPTIONS_BIT ," Reserved" +" (0x%2.2x)" , mask); +} +struct llcp_data {uint8_t opcode;const char *str;
@@ -517,8 +544,8 @@ static const struct llcp_data llcp_table[] = { { 0x13, "LL_PING_RSP", null_pdu, 0, true }, { 0x14, "LL_LENGTH_REQ", length_req_rsp, 8, true }, { 0x15, "LL_LENGTH_RSP", length_req_rsp, 8, true }, - { 0x16, "LL_PHY_REQ", NULL, 2, true }, - { 0x17, "LL_PHY_RSP", NULL, 2, true }, + { 0x16, "LL_PHY_REQ", phy_req_rsp, 2, true }, + { 0x17, "LL_PHY_RSP", phy_req_rsp, 2, true }, { 0x18, "LL_PHY_UPDATE_IND", NULL, 4, true }, { 0x19, "LL_MIN_USED_CHANNELS_IND", NULL, 2, true }, { }
Signature · 1 line
2.17.2
Luiz Augusto von Dentz
maintainerPATCH 3/7 monitor: Add decoding support for LL_PHY_UPDATE_IND
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This prints makes the fields to be printed instead of just decoding the PDU name.
--- monitor/bt.h | 7 +++++++ monitor/ll.c | 24 +++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-)
monitor/bt.h +7 -0
@@ -136,6 +136,13 @@ struct bt_ll_phy {#define BT_LL_PHY_RSP 0x17 +#define BT_LL_PHY_UPDATE_IND 0x18 +struct bt_ll_phy_update_ind { +uint8_t m_phy; +uint8_t s_phy; +uint16_t instant; +} __attribute__ ((packed)); +#define LMP_ESC4 (x) ((127 << 8) | (x))#define BT_LMP_NAME_REQ 1
monitor/ll.c +23 -1
@@ -513,6 +513,28 @@ static void phy_req_rsp(const void *data, uint8_t size) " (0x%2.2x)", mask); } +static void phy_update_ind (const void *data,uint8_t size) +{ +const struct bt_ll_phy_update_ind *pdu = data; +uint8_t mask; + +print_field ("M_TO_S_PHY: 0x%2.2x" , pdu->m_phy); + + mask =print_bitfield (2 , pdu->m_phy, le_phys); +if (mask) +print_text (COLOR_UNKNOWN_OPTIONS_BIT ," Reserved" +" (0x%2.2x)" , mask); + +print_field ("S_TO_M_PHY: 0x%2.2x" , pdu->s_phy); + + mask =print_bitfield (2 , pdu->s_phy, le_phys); +if (mask) +print_text (COLOR_UNKNOWN_OPTIONS_BIT ," Reserved" +" (0x%2.2x)" , mask); + +print_field ("Instant: 0x%4.4x" , pdu->instant); +} +struct llcp_data {uint8_t opcode;const char *str;
@@ -546,7 +568,7 @@ static const struct llcp_data llcp_table[] = { { 0x15, "LL_LENGTH_RSP", length_req_rsp, 8, true }, { 0x16, "LL_PHY_REQ", phy_req_rsp, 2, true }, { 0x17, "LL_PHY_RSP", phy_req_rsp, 2, true }, - { 0x18, "LL_PHY_UPDATE_IND", NULL, 4, true }, + { 0x18, "LL_PHY_UPDATE_IND", phy_update_ind, 4, true }, { 0x19, "LL_MIN_USED_CHANNELS_IND", NULL, 2, true }, { } };
Signature · 1 line
2.17.2
Luiz Augusto von Dentz
maintainerPATCH 4/7 monitor: Add decoding support for LL_MIN_USED_CHANNELS
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This prints makes the fields to be printed instead of just decoding the PDU name.
--- monitor/bt.h | 6 ++++++ monitor/ll.c | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-)
monitor/bt.h +6 -0
@@ -143,6 +143,12 @@ struct bt_ll_phy_update_ind {uint16_t instant; } __attribute__ ((packed)); +#define BT_LL_MIN_USED_CHANNELS 0x19 +struct bt_ll_min_used_channels { +uint8_t phys; +uint8_t min_channels; +} __attribute__ ((packed)); +#define LMP_ESC4 (x) ((127 << 8) | (x))#define BT_LMP_NAME_REQ 1
monitor/ll.c +16 -1
@@ -535,6 +535,21 @@ static void phy_update_ind(const void *data, uint8_t size)print_field ("Instant: 0x%4.4x" , pdu->instant); } +static void min_used_channels (const void *data,uint8_t size) +{ +const struct bt_ll_min_used_channels *pdu = data; +uint8_t mask; + +print_field ("PHYS: 0x%2.2x" , pdu->phys); + + mask =print_bitfield (2 , pdu->phys, le_phys); +if (mask) +print_text (COLOR_UNKNOWN_OPTIONS_BIT ," Reserved" +" (0x%2.2x)" , mask); + +print_field ("MinUsedChannels: 0x%2.2x" , pdu->min_channels); +} +struct llcp_data {uint8_t opcode;const char *str;
@@ -569,7 +584,7 @@ static const struct llcp_data llcp_table[] = { { 0x16, "LL_PHY_REQ", phy_req_rsp, 2, true }, { 0x17, "LL_PHY_RSP", phy_req_rsp, 2, true }, { 0x18, "LL_PHY_UPDATE_IND", phy_update_ind, 4, true }, - { 0x19, "LL_MIN_USED_CHANNELS_IND", NULL, 2, true }, + { 0x19, "LL_MIN_USED_CHANNELS_IND", min_used_channels, 2, true }, { } };
Signature · 1 line
2.17.2
Luiz Augusto von Dentz
maintainerPATCH 5/7 monitor: Decode LL_CTE_*
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This introduces the command passing for LL_CTE_* PDUs added in 5.1.
--- monitor/bt.h | 7 +++++++ monitor/ll.c | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+)
monitor/bt.h +7 -0
@@ -149,6 +149,13 @@ struct bt_ll_min_used_channels {uint8_t min_channels; } __attribute__ ((packed)); +#define BT_LL_CTE_REQ 0x1a +struct bt_ll_cte_req { +uint8_t cte; +} __attribute__ ((packed)); + +#define BT_LL_CTE_RSP 0x1b +#define LMP_ESC4 (x) ((127 << 8) | (x))#define BT_LMP_NAME_REQ 1
monitor/ll.c +22 -0
@@ -550,6 +550,26 @@ static void min_used_channels(const void *data, uint8_t size)print_field ("MinUsedChannels: 0x%2.2x" , pdu->min_channels); } +static void cte_req (const void *data,uint8_t size) +{ +const struct bt_ll_cte_req *pdu = data; + +print_field ("MinCTELenReq: 0x%2.2x" , pdu->cte &0xf8 ); +print_field ("CTETypeReq: 0x%2.2x" , pdu->cte &0x03 ); + +switch (pdu->cte &0x03 ) { +case 0x00 : +print_field (" AoA Constant Tone Extension" ); +break ; +case 0x01 : +print_field (" AoD Constant Tone Extension with 1 μs slots" ); +break ; +case 0x02 : +print_field (" AoD Constant Tone Extension with 2 μs slots" ); +break ; + } +} +struct llcp_data {uint8_t opcode;const char *str;
@@ -585,6 +605,8 @@ static const struct llcp_data llcp_table[] = { { 0x17, "LL_PHY_RSP", phy_req_rsp, 2, true }, { 0x18, "LL_PHY_UPDATE_IND", phy_update_ind, 4, true }, { 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 }, { } };
Signature · 1 line
2.17.2
Luiz Augusto von Dentz
maintainerPATCH 6/7 monitor: Decode LL_PERIODIC_SYNC_IND
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This introduces the command passing for LL_PERIODIC_SYNC_IND PDU added in 5.1.
--- monitor/bt.h | 12 ++++++++++++ monitor/ll.c | 25 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+)
monitor/bt.h +12 -0
@@ -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
monitor/ll.c +25 -0
@@ -570,6 +570,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;
@@ -607,6 +631,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 }, { } };
Signature · 1 line
2.17.2
Luiz Augusto von Dentz
maintainerPATCH 7/7 monitor: Decode LL_CLOCK_ACCURACY_*
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This introduces the command passing for LL_CLOCK_ACCURACY_* PDUs added in 5.1.
--- monitor/bt.h | 7 +++++++ monitor/ll.c | 9 +++++++++ 2 files changed, 16 insertions(+)
monitor/bt.h +7 -0
@@ -168,6 +168,13 @@ struct bt_ll_periodic_sync_ind {uint16_t sync_counter; } __attribute__ ((packed)); +#define BT_LL_CLOCK_ACCURACY_REQ 0x1d +struct bt_ll_clock_acc { +uint8_t sca; +} __attribute__ ((packed)); + +#define BT_LL_CLOCK_ACCURACY_RSP 0x1e +#define LMP_ESC4 (x) ((127 << 8) | (x))#define BT_LMP_NAME_REQ 1
monitor/ll.c +9 -0
@@ -594,6 +594,13 @@ static void periodic_sync_ind(const void *data, uint8_t size)print_field ("syncConnEventCount: 0x%4.4x" , pdu->sync_counter); } +static void clock_acc_req_rsp (const void *data,uint8_t size) +{ +const struct bt_ll_clock_acc *pdu = data; + +print_field ("SCA: 0x%2.2x" , pdu->sca); +} +struct llcp_data {uint8_t opcode;const char *str;
@@ -632,6 +639,8 @@ static const struct llcp_data llcp_table[] = { { 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 }, + { 0x1d, "LL_CLOCK_ACCURACY_REQ", clock_acc_req_rsp, 1, true }, + { 0x1e, "LL_CLOCK_ACCURACY_RSP", clock_acc_req_rsp, 1, true }, { } };
Signature · 1 line
2.17.2