From: Jaganath Kanakkassery <jaganath.k.os@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
Subject: [PATCH v1 03/10] monitor: Add support PHY management commands and event
Date: Thu, 12 Apr 2018 16:50:54 +0530 [thread overview]
Message-ID: <1523532061-17192-4-git-send-email-jaganathx.kanakkassery@intel.com> (raw)
In-Reply-To: <1523532061-17192-1-git-send-email-jaganathx.kanakkassery@intel.com>
---
monitor/packet.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)
diff --git a/monitor/packet.c b/monitor/packet.c
index b800a2d..e3b5ab7 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -97,6 +97,7 @@
#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
@@ -10611,6 +10612,7 @@ static const struct {
{ 13, "Privacy" },
{ 14, "Controller Configuration"},
{ 15, "Static Address" },
+ { 16, "PHY Configuration" },
{ }
};
@@ -11905,6 +11907,54 @@ static void mgmt_set_apperance_cmd(const void *data, uint16_t size)
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;
@@ -12118,6 +12168,12 @@ static const struct mgmt_data mgmt_command_table[] = {
{ 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 },
{ }
};
@@ -12496,6 +12552,13 @@ static void mgmt_ext_controller_info_changed_evt(const void *data, uint16_t size
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 },
@@ -12571,6 +12634,8 @@ static const struct mgmt_data mgmt_event_table[] = {
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 },
{ }
};
--
2.7.4
next prev parent reply other threads:[~2018-04-12 11:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-12 11:20 [PATCH v1 00/10] Extedned Adv, Scan, Connection and PHY support Jaganath Kanakkassery
2018-04-12 11:20 ` [PATCH v1 01/10] doc/mgmt-api: Add support for Set Phy Configuration command Jaganath Kanakkassery
2018-04-12 11:20 ` [PATCH v1 02/10] doc/mgmt-api: Add advertising phys support to flags Jaganath Kanakkassery
2018-04-12 11:20 ` Jaganath Kanakkassery [this message]
2018-06-21 14:29 ` [PATCH v1 03/10] monitor: Add support PHY management commands and event Marcel Holtmann
2018-04-12 11:20 ` [PATCH v1 04/10] btmgmt: Add PHY configuration get/set commands Jaganath Kanakkassery
2018-04-12 11:20 ` [PATCH v1 05/10] monitor: Add support for Secondary PHY flags in Add Advertising Jaganath Kanakkassery
2018-04-12 11:20 ` [PATCH v1 06/10] btmgmt: Add support for setting PHY in add-adv Jaganath Kanakkassery
2018-04-12 11:20 ` [PATCH v1 07/10] mgmt-tester: Add extended advertising test cases Jaganath Kanakkassery
2018-04-12 11:20 ` [PATCH v1 08/10] mgmt-tester: Add PHY Configuration " Jaganath Kanakkassery
2018-04-12 11:21 ` [PATCH v1 09/10] mgmt-tester: Add tests for extended scanning and device found Jaganath Kanakkassery
2018-04-12 11:21 ` [PATCH v1 10/10] mgmt-tester: Add support ext create connection and enh conn complete Jaganath Kanakkassery
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1523532061-17192-4-git-send-email-jaganathx.kanakkassery@intel.com \
--to=jaganath.k.os@gmail.com \
--cc=jaganathx.kanakkassery@intel.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).