diff --git a/monitor/packet.c b/monitor/packet.c
index 7705d2e..7046b92 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
#define COLOR_UNKNOWN_ADDRESS_TYPE COLOR_WHITE_BG
#define COLOR_UNKNOWN_DEVICE_FLAG COLOR_WHITE_BG
#define COLOR_UNKNOWN_ADV_FLAG COLOR_WHITE_BG
+#define COLOR_UNKNOWN_PHY COLOR_WHITE_BG
#define COLOR_PHY_PACKET COLOR_BLUE
{ 13, "Privacy" },
{ 14, "Controller Configuration"},
{ 15, "Static Address" },
+ { 16, "PHY Configuration" },
{ }
};
print_appearance(appearance);
}
+static const struct {
+ uint8_t bit;
+ const char *str;
+} mgmt_phy_table[] = {
+ { 0, "1MTX" },
+ { 1, "1MRX" },
+ { 2, "2MTX" },
+ { 3, "2MRX" },
+ { 4, "CODEDTX" },
+ { 5, "CODEDRX" },
+ { }
+};
+
+static void mgmt_print_phys(const char *label, uint16_t phys)
+{
+ uint16_t mask = phys;
+ int i;
+
+ print_field("%s: 0x%4.4x", label, phys);
+
+ for (i = 0; mgmt_phy_table[i].str; i++) {
+ if (phys & (1 << mgmt_phy_table[i].bit)) {
+ print_field(" %s", mgmt_phy_table[i].str);
+ mask &= ~(1 << mgmt_phy_table[i].bit);
+ }
+ }
+
+ if (mask)
+ print_text(COLOR_UNKNOWN_PHY, " Unknown PHYs"
+ " (0x%8.8x)", mask);
+}
+
+static void mgmt_get_phy_rsp(const void *data, uint16_t size)
+{
+ uint16_t supported_phys = get_le16(data);
+ uint16_t selected_phys = get_le16(data + 2);
+
+ mgmt_print_phys("Supported PHYs", supported_phys);
+ mgmt_print_phys("Selected PHYs", selected_phys);
+}
+
+static void mgmt_set_phy_cmd(const void *data, uint16_t size)
+{
+ uint16_t default_phys = get_le16(data);
+
+ mgmt_print_phys("Default PHYs", default_phys);
+}
+
struct mgmt_data {
uint16_t opcode;
const char *str;
{ 0x0043, "Set Appearance",
mgmt_set_apperance_cmd, 2, true,
mgmt_null_rsp, 0, true },
+ { 0x0044, "Get PHY Configuration",
+ mgmt_null_cmd, 0, true,
+ mgmt_get_phy_rsp, 4, true },
+ { 0x0045, "Set PHY Configuration",
+ mgmt_set_phy_cmd, 2, true,
+ mgmt_null_rsp, 0, true },
{ }
};
print_eir(data + 2, size - 2, false);
}
+static void mgmt_phy_changed_evt(const void *data, uint16_t size)
+{
+ uint16_t selected_phys = get_le16(data);
+
+ mgmt_print_phys("Selected PHYs", selected_phys);
+}
+
static const struct mgmt_data mgmt_event_table[] = {
{ 0x0001, "Command Complete",
mgmt_command_complete_evt, 3, false },
mgmt_advertising_removed_evt, 1, true },
{ 0x0025, "Extended Controller Information Changed",
mgmt_ext_controller_info_changed_evt, 2, false },
+ { 0x0026, "PHY Configuration Changed",
+ mgmt_phy_changed_evt, 2, true },
{ }
};