summaryrefslogtreecommitdiff
path: root/monitor/ll.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2019-02-26 14:51:25 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2019-03-07 09:37:12 +0200
commit62f234823283be806822f14da757f8d975a0f6fb (patch)
tree4c0198a0915d00ff3c11975e80d31c85d39d4070 /monitor/ll.c
parent5df33d7990412928d6182a5360f2701b38496d3d (diff)
downloadbluez-62f234823283be806822f14da757f8d975a0f6fb.tar.gz
monitor: Add decoding support for LL_PHY_*
This prints makes the fields to be printed instead of just decoding the PDU name.
Diffstat (limited to 'monitor/ll.c')
-rw-r--r--monitor/ll.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/monitor/ll.c b/monitor/ll.c
index c70c1166f..a65c93498 100644
--- a/monitor/ll.c
+++ b/monitor/ll.c
@@ -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 },
{ }