public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support
@ 2017-06-06  9:40 Michał Narajowski
  2017-06-06  9:40 ` [PATCH BlueZ 01/31] monitor: Add LE Enhanced Receiver Test decoding Michał Narajowski
                   ` (33 more replies)
  0 siblings, 34 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

Hi,

this set adds support for decoding Bluetooth 5 commands as listed below.

Michał Narajowski (31):
  monitor: Add LE Enhanced Receiver Test decoding
  monitor: Add LE Enhanced Transmitter Test decoding
  monitor: Add LE Set Advertising Set Random Address decoding
  monitor: Add LE Set Extended Advertising Parameters decoding
  monitor: Add LE Set Extended Advertising Data decoding
  monitor: Add LE Set Extended Scan Response Data decoding
  monitor: Add LE Set Extended Advertising Enable decoding
  monitor: Add LE Read Maximum Advertising Data Length decoding
  monitor: Add LE Read Number of Supported Advertising Sets decoding
  monitor: Add LE Remove Advertising Set decoding
  monitor: Add LE Clear Advertising Sets decoding
  monitor: Add LE Set Periodic Advertising Parameters decoding
  monitor: Add LE Set Periodic Advertising Data decoding
  monitor: Add LE Set Periodic Advertising Enable decoding
  monitor: Add LE Set Extended Scan Parameters decoding
  monitor: Add LE Set Extended Scan Enable decoding
  monitor: Add LE Extended Create Connection decoding
  monitor: Add LE Periodic Advertising Create Sync decoding
  monitor: Add LE Periodic Advertising Create Sync Cancel decoding
  monitor: Add LE Periodic Advertising Terminate Sync decoding
  monitor: Add LE Add Device To Periodic Advertiser List decoding
  monitor: Add LE Remove Device From Periodic Advertiser List decoding
  monitor: Add LE Clear Periodic Advertiser List decoding
  monitor: Add LE Read Periodic Advertiser List Size decoding
  monitor: Add LE Read Transmit Power decoding
  monitor: Add LE Read RF Path Compensation decoding
  monitor: Add LE Write RF Path Compensation decoding
  monitor: Add LE Set Privacy Mode decoding
  monitor: Add LE Extended Advertising Report Event decoding
  monitor: Add LE Advertising Set Terminated Event decoding
  monitor: Add LE Scan Request Received Event decoding

 monitor/bt.h     |  253 ++++++++++++++
 monitor/packet.c | 1017 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 1235 insertions(+), 35 deletions(-)

-- 
2.9.3


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 01/31] monitor: Add LE Enhanced Receiver Test decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
@ 2017-06-06  9:40 ` Michał Narajowski
  2017-06-06  9:40 ` [PATCH BlueZ 1/2] monitor: Add LE Set Extended Scan Parameters decoding Michał Narajowski
                   ` (32 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Enhanced Receiver Test (0x08|0x0033) plen 3
        RX channel: 0x01
        PHY: LE 1M (0x01)
        Modulation index: Stable (0x01)
---
 monitor/bt.h     |  7 +++++++
 monitor/packet.c | 28 +++++++++++++++++++++++++++-
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index c2045bb..2aed400 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2161,6 +2161,13 @@ struct bt_hci_cmd_le_set_phy {
 	uint16_t phy_opts;
 } __attribute__((packed));
 
+#define BT_HCI_CMD_LE_ENHANCED_RECEIVER_TEST			0x2033
+struct bt_hci_cmd_le_enhanced_receiver_test {
+	uint8_t rx_channel;
+	uint8_t phy;
+	uint8_t modulation_index;
+} __attribute__((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 7d1c5e8..e3fcd2f 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -6876,6 +6876,30 @@ static void le_set_phy_cmd(const void *data, uint8_t size)
 	print_field("PHY options preference: %s (0x%4.4x)", str, cmd->phy_opts);
 }
 
+static void le_enhanced_receiver_test_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_enhanced_receiver_test *cmd = data;
+	const char *str;
+
+	print_field("RX channel frequency: %d MHz (0x%2.2x)",
+				(cmd->rx_channel * 2) + 2402, cmd->rx_channel);
+	print_le_phy("PHY", cmd->phy);
+
+	switch (cmd->modulation_index) {
+	case 0x00:
+		str = "Standard";
+		break;
+	case 0x01:
+		str = "Stable";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+
+	print_field("Modulation index: %s (0x%2.2x)", str, cmd->modulation_index);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -7579,7 +7603,9 @@ static const struct opcode_data opcode_table[] = {
 				status_rsp, 1, true },
 	{ 0x2032, 286, "LE Set PHY",
 				le_set_phy_cmd, 7, true},
-	{ 0x2033, 287, "LE Enhanced Receiver Test" },
+	{ 0x2033, 287, "LE Enhanced Receiver Test",
+				le_enhanced_receiver_test_cmd, 3, true,
+				status_rsp, 1, true },
 	{ 0x2034, 288, "LE Enhanced Transmitter Test" },
 	{ 0x2035, 289, "LE Set Advertising Set Random Address" },
 	{ 0x2036, 290, "LE Set Extended Advertising Parameters" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 1/2] monitor: Add LE Set Extended Scan Parameters decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
  2017-06-06  9:40 ` [PATCH BlueZ 01/31] monitor: Add LE Enhanced Receiver Test decoding Michał Narajowski
@ 2017-06-06  9:40 ` Michał Narajowski
  2017-06-08  8:38   ` Marcel Holtmann
  2017-06-06  9:40 ` [PATCH BlueZ 02/31] monitor: Add LE Enhanced Transmitter Test decoding Michał Narajowski
                   ` (31 subsequent siblings)
  33 siblings, 1 reply; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

---
 monitor/bt.h     | 12 +++++++
 monitor/packet.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 109 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index 660564a..5ec3e5e 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2272,6 +2272,18 @@ struct bt_hci_cmd_le_set_periodic_adv_enable {
 	uint8_t  handle;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_SET_EXT_SCAN_PARAMS		0x2041
+struct bt_hci_cmd_le_set_ext_scan_params {
+	uint8_t  own_addr_type;
+	uint8_t  filter_policy;
+	uint8_t  phys;
+} __attribute__ ((packed));
+struct bt_hci_le_scan_phy {
+	uint8_t  type;
+	uint16_t  interval;
+	uint16_t  window;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 8ffda90..fb6aee2 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7336,6 +7336,101 @@ static void le_set_periodic_adv_enable_cmd(const void *data, uint8_t size)
 	print_handle(cmd->handle);
 }
 
+static const struct {
+	uint8_t bit;
+	const char *str;
+} ext_scan_phys_table[] = {
+	{  0, "LE 1M"		},
+	{  2, "LE Coded"		},
+	{ }
+};
+
+static int print_ext_scan_phys(uint8_t flags)
+{
+	uint8_t mask = flags;
+	int bits_set = 0;
+	int i;
+
+	print_field("PHYs: 0x%2.2x", flags);
+
+	for (i = 0; ext_scan_phys_table[i].str; i++) {
+		if (flags & (1 << ext_scan_phys_table[i].bit)) {
+			print_field("  %s", ext_scan_phys_table[i].str);
+			mask &= ~(1 << ext_scan_phys_table[i].bit);
+			++bits_set;
+		}
+	}
+
+	if (mask)
+		print_text(COLOR_UNKNOWN_ADV_FLAG, "  Unknown scanning PHYs"
+							" (0x%2.2x)", mask);
+	return bits_set;
+}
+
+static void print_scan_filter_policy(uint8_t policy)
+{
+	const char *str;
+
+	switch (policy) {
+	case 0x00:
+		str = "Accept all advertisement";
+		break;
+	case 0x01:
+		str = "Ignore not in white list";
+		break;
+	case 0x02:
+		str = "Accept all advertisement, inc. directed unresolved RPA";
+		break;
+	case 0x03:
+		str = "Ignore not in white list, exc. directed unresolved RPA";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+
+	print_field("Filter policy: %s (0x%2.2x)", str, policy);
+}
+
+static void print_scan_type(uint8_t type)
+{
+	const char *str;
+
+	switch (type) {
+	case 0x00:
+		str = "Passive";
+		break;
+	case 0x01:
+		str = "Active";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+
+	print_field("Type: %s (0x%2.2x)", str, type);
+}
+
+static void le_set_ext_scan_params_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_set_ext_scan_params *cmd = data;
+	const struct bt_hci_le_scan_phy *scan_phy;
+	int num_structs;
+	int i;
+
+	print_own_addr_type(cmd->own_addr_type);
+	print_scan_filter_policy(cmd->filter_policy);
+	num_structs = print_ext_scan_phys(cmd->phys);
+
+	for (i = 0; i < num_structs; ++i) {
+		scan_phy = data + 3 + i * sizeof(struct bt_hci_le_scan_phy);
+
+		print_scan_type(scan_phy->type);
+		print_interval(scan_phy->interval);
+		print_window(scan_phy->window);
+	}
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8070,7 +8165,8 @@ static const struct opcode_data opcode_table[] = {
 				le_set_periodic_adv_data_cmd, 3, false },
 	{ 0x2040, 300, "LE Set Periodic Advertising Enable",
 				le_set_periodic_adv_enable_cmd, 2, true },
-	{ 0x2041, 301, "LE Set Extended Scan Parameters" },
+	{ 0x2041, 301, "LE Set Extended Scan Parameters",
+				le_set_ext_scan_params_cmd, 3, false },
 	{ 0x2042, 302, "LE Set Extended Scan Enable" },
 	{ 0x2043, 303, "LE Extended Create Connection" },
 	{ 0x2044, 304, "LE Periodic Advertising Create Sync" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 02/31] monitor: Add LE Enhanced Transmitter Test decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
  2017-06-06  9:40 ` [PATCH BlueZ 01/31] monitor: Add LE Enhanced Receiver Test decoding Michał Narajowski
  2017-06-06  9:40 ` [PATCH BlueZ 1/2] monitor: Add LE Set Extended Scan Parameters decoding Michał Narajowski
@ 2017-06-06  9:40 ` Michał Narajowski
  2017-06-06  9:40 ` [PATCH BlueZ 2/2] monitor: Add LE Set Extended Scan Enable decoding Michał Narajowski
                   ` (30 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Enhanced Transmitter Test (0x08|0x0034) plen 4
        TX channel frequency: 2402 MHz (0x00)
        Test data length: 255 bytes
        Packet payload: 0x01
        PHY: LE Coded with S=8 (0x03)
---
 monitor/bt.h     |  8 ++++++++
 monitor/packet.c | 35 ++++++++++++++++++++++++++++++++++-
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index 2aed400..a877b2c 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2168,6 +2168,14 @@ struct bt_hci_cmd_le_enhanced_receiver_test {
 	uint8_t modulation_index;
 } __attribute__((packed));
 
+#define BT_HCI_CMD_LE_ENHANCED_TRANSMITTER_TEST			0x2034
+struct bt_hci_cmd_le_enhanced_transmitter_test {
+	uint8_t tx_channel;
+	uint8_t data_len;
+	uint8_t payload;
+	uint8_t phy;
+} __attribute__((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index e3fcd2f..b77b2cc 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -6900,6 +6900,37 @@ static void le_enhanced_receiver_test_cmd(const void *data, uint8_t size)
 	print_field("Modulation index: %s (0x%2.2x)", str, cmd->modulation_index);
 }
 
+static void le_enhanced_transmitter_test_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_enhanced_transmitter_test *cmd = data;
+	const char *str;
+
+	print_field("TX channel frequency: %d MHz (0x%2.2x)",
+				(cmd->tx_channel * 2) + 2402, cmd->tx_channel);
+	print_field("Test data length: %d bytes", cmd->data_len);
+	print_field("Packet payload: 0x%2.2x", cmd->payload);
+
+	switch (cmd->phy) {
+	case 0x01:
+		str = "LE 1M";
+		break;
+	case 0x02:
+		str = "LE 2M";
+		break;
+	case 0x03:
+		str = "LE Coded with S=8";
+		break;
+	case 0x04:
+		str = "LE Coded with S=2";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+
+	print_field("PHY: %s (0x%2.2x)", str, cmd->phy);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -7606,7 +7637,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2033, 287, "LE Enhanced Receiver Test",
 				le_enhanced_receiver_test_cmd, 3, true,
 				status_rsp, 1, true },
-	{ 0x2034, 288, "LE Enhanced Transmitter Test" },
+	{ 0x2034, 288, "LE Enhanced Transmitter Test",
+				le_enhanced_transmitter_test_cmd, 4, true,
+				status_rsp, 1, true },
 	{ 0x2035, 289, "LE Set Advertising Set Random Address" },
 	{ 0x2036, 290, "LE Set Extended Advertising Parameters" },
 	{ 0x2037, 291, "LE Set Extended Advertising Data" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 2/2] monitor: Add LE Set Extended Scan Enable decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (2 preceding siblings ...)
  2017-06-06  9:40 ` [PATCH BlueZ 02/31] monitor: Add LE Enhanced Transmitter Test decoding Michał Narajowski
@ 2017-06-06  9:40 ` Michał Narajowski
  2017-06-06  9:40 ` [PATCH BlueZ 03/31] monitor: Add LE Set Advertising Set Random Address decoding Michał Narajowski
                   ` (29 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

---
 monitor/bt.h     |  8 ++++++++
 monitor/packet.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index 5ec3e5e..fb591e7 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2284,6 +2284,14 @@ struct bt_hci_le_scan_phy {
 	uint16_t  window;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_SET_EXT_SCAN_ENABLE		0x2042
+struct bt_hci_cmd_le_set_ext_scan_enable {
+	uint8_t  enable;
+	uint8_t  filter_dup;
+	uint16_t  duration;
+	uint16_t  period;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index fb6aee2..2a4671e 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7431,6 +7431,57 @@ static void le_set_ext_scan_params_cmd(const void *data, uint8_t size)
 	}
 }
 
+static void print_enable(const char *label, uint8_t enable)
+{
+	const char *str;
+
+	switch (enable) {
+	case 0x00:
+		str = "Disable";
+		break;
+	case 0x01:
+		str = "Enabled";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+
+	print_field("%s: %s", label, str);
+}
+
+static void print_filter_dup(uint8_t filter_dup)
+{
+	const char *str;
+
+	switch (filter_dup) {
+	case 0x00:
+		str = "Disabled";
+		break;
+	case 0x01:
+		str = "Enabled";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+
+	print_field("Filter duplicates: %s (0x%2.2x)", str, filter_dup);
+}
+
+static void le_set_ext_scan_enable_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_set_ext_scan_enable *cmd = data;
+
+	print_enable("Extended scan", cmd->enable);
+	print_filter_dup(cmd->filter_dup);
+
+	print_field("Duration: %d msec (0x%4.4x)",
+			le16_to_cpu(cmd->duration) * 10, le16_to_cpu(cmd->duration));
+	print_field("Period: %.2f sec (0x%4.4x)",
+			le16_to_cpu(cmd->period) * 1.28, le16_to_cpu(cmd->period));
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8167,7 +8218,8 @@ static const struct opcode_data opcode_table[] = {
 				le_set_periodic_adv_enable_cmd, 2, true },
 	{ 0x2041, 301, "LE Set Extended Scan Parameters",
 				le_set_ext_scan_params_cmd, 3, false },
-	{ 0x2042, 302, "LE Set Extended Scan Enable" },
+	{ 0x2042, 302, "LE Set Extended Scan Enable",
+				le_set_ext_scan_enable_cmd, 6, true },
 	{ 0x2043, 303, "LE Extended Create Connection" },
 	{ 0x2044, 304, "LE Periodic Advertising Create Sync" },
 	{ 0x2045, 305, "LE Periodic Advertising Create Sync Cancel" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 03/31] monitor: Add LE Set Advertising Set Random Address decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (3 preceding siblings ...)
  2017-06-06  9:40 ` [PATCH BlueZ 2/2] monitor: Add LE Set Extended Scan Enable decoding Michał Narajowski
@ 2017-06-06  9:40 ` Michał Narajowski
  2017-06-06  9:40 ` [PATCH BlueZ 04/31] monitor: Add LE Set Extended Advertising Parameters decoding Michał Narajowski
                   ` (28 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Set Advertising Set Random Address (0x08|0x0035) plen 7
        Advertising handle: 0x01
        Advertising random address: FF:EE:DD:CC:BB:AA (OUI FF-EE-DD)
---
 monitor/bt.h     |  6 ++++++
 monitor/packet.c | 12 +++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index a877b2c..d2e3e16 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2176,6 +2176,12 @@ struct bt_hci_cmd_le_enhanced_transmitter_test {
 	uint8_t phy;
 } __attribute__((packed));
 
+#define BT_HCI_CMD_LE_SET_ADV_SET_RAND_ADDR			0x2035
+struct bt_hci_cmd_le_set_adv_set_rand_addr {
+	uint8_t  handle;
+	uint8_t  bdaddr[6];
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index b77b2cc..771b7bb 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -6931,6 +6931,14 @@ static void le_enhanced_transmitter_test_cmd(const void *data, uint8_t size)
 	print_field("PHY: %s (0x%2.2x)", str, cmd->phy);
 }
 
+static void le_set_adv_set_rand_addr(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_set_adv_set_rand_addr *cmd = data;
+
+	print_field("Advertising handle: 0x%2.2x", cmd->handle);
+	print_addr("Advertising random address", cmd->bdaddr, 0x00);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -7640,7 +7648,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2034, 288, "LE Enhanced Transmitter Test",
 				le_enhanced_transmitter_test_cmd, 4, true,
 				status_rsp, 1, true },
-	{ 0x2035, 289, "LE Set Advertising Set Random Address" },
+	{ 0x2035, 289, "LE Set Advertising Set Random Address",
+				le_set_adv_set_rand_addr, 7, true,
+				status_rsp, 1, true },
 	{ 0x2036, 290, "LE Set Extended Advertising Parameters" },
 	{ 0x2037, 291, "LE Set Extended Advertising Data" },
 	{ 0x2038, 292, "LE Set Extended Scan Response Data" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 04/31] monitor: Add LE Set Extended Advertising Parameters decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (4 preceding siblings ...)
  2017-06-06  9:40 ` [PATCH BlueZ 03/31] monitor: Add LE Set Advertising Set Random Address decoding Michał Narajowski
@ 2017-06-06  9:40 ` Michał Narajowski
  2017-06-08  8:44   ` Marcel Holtmann
  2017-06-08 13:00   ` Szymon Janc
  2017-06-06  9:40 ` [PATCH BlueZ 05/31] monitor: Add LE Set Extended Advertising Data decoding Michał Narajowski
                   ` (27 subsequent siblings)
  33 siblings, 2 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Set Extended Advertising Parameters (0x08|0x0036) plen 25
        Handle: 0x01
        Properties: 0x0000
        Min advertising interval: 20.000 msec (0x0020)
        Max advertising interval: 159.375 msec (0x00ff)
        Channel map: 37, 38, 39 (0x07)
        Own address type: Random (0x01)
        Peer address type: Public (0x00)
        Peer address: 00:00:00:00:00:00 (OUI 00-00-00)
        Filter policy: Allow Scan Request from Any, Allow Connect Request from Any (0x00)
        Tx power: 0xff
        Primary PHY: LE 1M
        Secondary max skip: 0x00
        Secondary PHY: LE Coded (0x03)
        SID: 0x06
        Scan request notifications: Disabled
---
 monitor/bt.h     |  24 +++++++++
 monitor/packet.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 181 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index d2e3e16..e903366 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2182,6 +2182,30 @@ struct bt_hci_cmd_le_set_adv_set_rand_addr {
 	uint8_t  bdaddr[6];
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS			0x2036
+struct bt_hci_cmd_le_set_ext_adv_params {
+	uint8_t  handle;
+	uint16_t evt_properties;
+	uint8_t  min_interval[3];
+	uint8_t  max_interval[3];
+	uint8_t  channel_map;
+	uint8_t  own_addr_type;
+	uint8_t  peer_addr_type;
+	uint8_t  peer_addr[6];
+	uint8_t  filter_policy;
+	uint8_t  tx_power;
+	uint8_t  primary_phy;
+	uint8_t  secondary_max_skip;
+	uint8_t  secondary_phy;
+	uint8_t  sid;
+	uint8_t  notif_enable;
+} __attribute__ ((packed));
+struct bt_hci_rsp_le_set_ext_adv_params {
+	uint8_t  status;
+	uint8_t  tx_power;
+} __attribute__ ((packed));
+
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 771b7bb..35ffde9 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -6939,6 +6939,160 @@ static void le_set_adv_set_rand_addr(const void *data, uint8_t size)
 	print_addr("Advertising random address", cmd->bdaddr, 0x00);
 }
 
+static const struct {
+	uint8_t bit;
+	const char *str;
+} ext_adv_properties_table[] = {
+	{  0, "Connectable"		},
+	{  1, "Scannable"		},
+	{  2, "Directed"	},
+	{  3, "High Duty Cycle Directed Connectable"	},
+	{  4, "Use legacy advertising PDUs"	},
+	{  5, "Anonymous advertising"	},
+	{  6, "Include TxPower"		},
+	{ }
+};
+
+static void print_ext_adv_properties(uint16_t flags)
+{
+	uint16_t mask = flags;
+	int i;
+
+	print_field("Properties: 0x%4.4x", flags);
+
+	for (i = 0; ext_adv_properties_table[i].str; i++) {
+		if (flags & (1 << ext_adv_properties_table[i].bit)) {
+			print_field("  %s", ext_adv_properties_table[i].str);
+			mask &= ~(1 << ext_adv_properties_table[i].bit);
+		}
+	}
+
+	if (mask)
+		print_text(COLOR_UNKNOWN_ADV_FLAG, "  Unknown advertising properties"
+							" (0x%4.4x)", mask);
+}
+
+static void print_ext_slot_625(const char *label, const uint8_t value[3])
+{
+	uint32_t value_cpu = value[0];
+
+	value_cpu |= value[1] << 8;
+	value_cpu |= value[2] << 16;
+
+	 print_field("%s: %.3f msec (0x%4.4x)", label,
+				 value_cpu * 0.625, value_cpu);
+}
+
+
+static void le_set_ext_adv_params_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_set_ext_adv_params *cmd = data;
+	const char *str;
+
+	print_field("Handle: 0x%2.2x", cmd->handle);
+	print_ext_adv_properties(le16_to_cpu(cmd->evt_properties));
+
+	print_ext_slot_625("Min advertising interval", cmd->min_interval);
+	print_ext_slot_625("Max advertising interval", cmd->max_interval);
+
+	switch (cmd->channel_map) {
+	case 0x01:
+		str = "37";
+		break;
+	case 0x02:
+		str = "38";
+		break;
+	case 0x03:
+		str = "37, 38";
+		break;
+	case 0x04:
+		str = "39";
+		break;
+	case 0x05:
+		str = "37, 39";
+		break;
+	case 0x06:
+		str = "38, 39";
+		break;
+	case 0x07:
+		str = "37, 38, 39";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+
+	print_field("Channel map: %s (0x%2.2x)", str, cmd->channel_map);
+
+	print_own_addr_type(cmd->own_addr_type);
+	print_peer_addr_type("Peer address type", cmd->peer_addr_type);
+	print_addr("Peer address", cmd->peer_addr, cmd->peer_addr_type);
+
+	switch (cmd->filter_policy) {
+	case 0x00:
+		str = "Allow Scan Request from Any, "
+			"Allow Connect Request from Any";
+		break;
+	case 0x01:
+		str = "Allow Scan Request from White List Only, "
+			"Allow Connect Request from Any";
+		break;
+	case 0x02:
+		str = "Allow Scan Request from Any, "
+			"Allow Connect Request from White List Only";
+		break;
+	case 0x03:
+		str = "Allow Scan Request from White List Only, "
+			"Allow Connect Request from White List Only";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+
+	print_field("Filter policy: %s (0x%2.2x)", str, cmd->filter_policy);
+	print_field("Tx power: 0x%2.2x", cmd->tx_power);
+
+	switch (cmd->primary_phy) {
+	case 0x01:
+		str = "LE 1M";
+		break;
+	case 0x03:
+		str = "LE Coded";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+
+	print_field("Primary PHY: %s", str);
+	print_field("Secondary max skip: 0x%2.2x", cmd->secondary_max_skip);
+	print_le_phy("Secondary PHY", cmd->secondary_phy);
+	print_field("SID: 0x%2.2x", cmd->sid);
+
+
+	switch (cmd->notif_enable) {
+	case 0x00:
+		str = "Disabled";
+		break;
+	case 0x01:
+		str = "Enabled";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+	print_field("Scan request notifications: %s", str);
+}
+
+static void le_set_ext_adv_params_rsp(const void *data, uint8_t size)
+{
+	const struct bt_hci_rsp_le_set_ext_adv_params *rsp = data;
+
+	print_status(rsp->status);
+	print_field("Selected Tx power: 0x%2.2x", rsp->tx_power);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -7651,7 +7805,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2035, 289, "LE Set Advertising Set Random Address",
 				le_set_adv_set_rand_addr, 7, true,
 				status_rsp, 1, true },
-	{ 0x2036, 290, "LE Set Extended Advertising Parameters" },
+	{ 0x2036, 290, "LE Set Extended Advertising Parameters",
+				le_set_ext_adv_params_cmd, 25, true,
+				le_set_ext_adv_params_rsp, 2, true },
 	{ 0x2037, 291, "LE Set Extended Advertising Data" },
 	{ 0x2038, 292, "LE Set Extended Scan Response Data" },
 	{ 0x2039, 293, "LE Set Extended Advertising Enable" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 05/31] monitor: Add LE Set Extended Advertising Data decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (5 preceding siblings ...)
  2017-06-06  9:40 ` [PATCH BlueZ 04/31] monitor: Add LE Set Extended Advertising Parameters decoding Michał Narajowski
@ 2017-06-06  9:40 ` Michał Narajowski
  2017-06-06  9:40 ` [PATCH BlueZ 06/31] monitor: Add LE Set Extended Scan Response " Michał Narajowski
                   ` (26 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Set Extended Advertising Data (0x08|0x0037) plen 9
        Handle: 0x01
        Operation: Complete extended advertising data
        Fragment preference: Fragment all
        Data length: 0x05
        a0 a1 a2 a3 a4                                   .....
---
 monitor/bt.h     |  8 ++++++++
 monitor/packet.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index e903366..ba9ee99 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2205,6 +2205,14 @@ struct bt_hci_rsp_le_set_ext_adv_params {
 	uint8_t  tx_power;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_SET_EXT_ADV_DATA			0x2037
+struct bt_hci_cmd_le_set_ext_adv_data {
+	uint8_t  handle;
+	uint8_t  operation;
+	uint8_t  fragment_preference;
+	uint8_t  data_len;
+	uint8_t  data[0];
+} __attribute__ ((packed));
 
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
diff --git a/monitor/packet.c b/monitor/packet.c
index 35ffde9..5e20002 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7093,6 +7093,51 @@ static void le_set_ext_adv_params_rsp(const void *data, uint8_t size)
 	print_field("Selected Tx power: 0x%2.2x", rsp->tx_power);
 }
 
+static void le_set_ext_adv_data_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_set_ext_adv_data *cmd = data;
+	const char *str;
+
+	print_field("Handle: 0x%2.2x", cmd->handle);
+
+	switch (cmd->operation) {
+	case 0x00:
+		str = "Immediate fragment";
+		break;
+	case 0x01:
+		str = "First fragment";
+		break;
+	case 0x02:
+		str = "Last fragment";
+		break;
+	case 0x03:
+		str = "Complete extended advertising data";
+		break;
+	case 0x04:
+		str = "Unchanged data";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+	print_field("Operation: %s", str);
+
+	switch (cmd->fragment_preference) {
+	case 0x00:
+		str = "Fragment all";
+		break;
+	case 0x01:
+		str = "Minimize fragmentation";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+	print_field("Fragment preference: %s", str);
+	print_field("Data length: 0x%2.2x", cmd->data_len);
+	packet_print_ad(cmd->data, size - sizeof(*cmd));
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -7808,7 +7853,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2036, 290, "LE Set Extended Advertising Parameters",
 				le_set_ext_adv_params_cmd, 25, true,
 				le_set_ext_adv_params_rsp, 2, true },
-	{ 0x2037, 291, "LE Set Extended Advertising Data" },
+	{ 0x2037, 291, "LE Set Extended Advertising Data",
+				le_set_ext_adv_data_cmd, 4, false,
+				status_rsp, 1, true },
 	{ 0x2038, 292, "LE Set Extended Scan Response Data" },
 	{ 0x2039, 293, "LE Set Extended Advertising Enable" },
 	{ 0x203a, 294, "LE Read Maximum Advertising Data Length" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 06/31] monitor: Add LE Set Extended Scan Response Data decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (6 preceding siblings ...)
  2017-06-06  9:40 ` [PATCH BlueZ 05/31] monitor: Add LE Set Extended Advertising Data decoding Michał Narajowski
@ 2017-06-06  9:40 ` Michał Narajowski
  2017-06-06  9:40 ` [PATCH BlueZ 07/31] monitor: Add LE Set Extended Advertising Enable decoding Michał Narajowski
                   ` (25 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Set Extended Scan Response Data (0x08|0x0038) plen 9
        Handle: 0x01
        Operation: Complete scan response data
        Fragment preference: Fragment all
        Data length: 0x05
        b0 b1 b2 b3 b4                                   .....
---
 monitor/bt.h     |  9 +++++++++
 monitor/packet.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 57 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index ba9ee99..b3a8816 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2214,6 +2214,15 @@ struct bt_hci_cmd_le_set_ext_adv_data {
 	uint8_t  data[0];
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_SET_EXT_SCAN_RSP_DATA			0x2038
+struct bt_hci_cmd_le_set_ext_scan_rsp_data {
+	uint8_t  handle;
+	uint8_t  operation;
+	uint8_t  fragment_preference;
+	uint8_t  data_len;
+	uint8_t  data[0];
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 5e20002..30b50c3 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7138,6 +7138,51 @@ static void le_set_ext_adv_data_cmd(const void *data, uint8_t size)
 	packet_print_ad(cmd->data, size - sizeof(*cmd));
 }
 
+static void le_set_ext_scan_rsp_data_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_set_ext_scan_rsp_data *cmd = data;
+	const char *str;
+
+	print_field("Handle: 0x%2.2x", cmd->handle);
+
+	switch (cmd->operation) {
+	case 0x00:
+		str = "Immediate fragment";
+		break;
+	case 0x01:
+		str = "First fragment";
+		break;
+	case 0x02:
+		str = "Last fragment";
+		break;
+	case 0x03:
+		str = "Complete scan response data";
+		break;
+	case 0x04:
+		str = "Unchanged data";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+	print_field("Operation: %s", str);
+
+	switch (cmd->fragment_preference) {
+	case 0x00:
+		str = "Fragment all";
+		break;
+	case 0x01:
+		str = "Minimize fragmentation";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+	print_field("Fragment preference: %s", str);
+	print_field("Data length: 0x%2.2x", cmd->data_len);
+	packet_print_ad(cmd->data, size - sizeof(*cmd));
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -7856,7 +7901,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2037, 291, "LE Set Extended Advertising Data",
 				le_set_ext_adv_data_cmd, 4, false,
 				status_rsp, 1, true },
-	{ 0x2038, 292, "LE Set Extended Scan Response Data" },
+	{ 0x2038, 292, "LE Set Extended Scan Response Data",
+				le_set_ext_scan_rsp_data_cmd, 4, false,
+				status_rsp, 1, true },
 	{ 0x2039, 293, "LE Set Extended Advertising Enable" },
 	{ 0x203a, 294, "LE Read Maximum Advertising Data Length" },
 	{ 0x203b, 295, "LE Read Number of Supported Advertising Sets" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 07/31] monitor: Add LE Set Extended Advertising Enable decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (7 preceding siblings ...)
  2017-06-06  9:40 ` [PATCH BlueZ 06/31] monitor: Add LE Set Extended Scan Response " Michał Narajowski
@ 2017-06-06  9:40 ` Michał Narajowski
  2017-06-06  9:40 ` [PATCH BlueZ 08/31] monitor: Add LE Read Maximum Advertising Data Length decoding Michał Narajowski
                   ` (24 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Set Extended Advertising Enable (0x08|0x0039) plen 24
        Ext adv: Enabled
        Number of sets: 2
        Entry 0
          Handle: 0xff
          Duration: 0 ms (0x00)
          Max ext adv events: 0
        Entry 1
          Handle: 0x00
          Duration: 0 ms (0x00)
          Max ext adv events: 1
---
 monitor/bt.h     | 11 +++++++++++
 monitor/packet.c | 42 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index b3a8816..8dd0d57 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2223,6 +2223,17 @@ struct bt_hci_cmd_le_set_ext_scan_rsp_data {
 	uint8_t  data[0];
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_SET_EXT_ADV_ENABLE			0x2039
+struct bt_hci_cmd_le_set_ext_adv_enable {
+	uint8_t  enable;
+	uint8_t  num_of_sets;
+} __attribute__ ((packed));
+struct bt_hci_cmd_ext_adv_set {
+	uint8_t  handle;
+	uint16_t  duration;
+	uint8_t  max_events;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 30b50c3..f109b4f 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7183,6 +7183,44 @@ static void le_set_ext_scan_rsp_data_cmd(const void *data, uint8_t size)
 	packet_print_ad(cmd->data, size - sizeof(*cmd));
 }
 
+static void le_set_ext_adv_enable_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_set_ext_adv_enable *cmd = data;
+	const struct bt_hci_cmd_ext_adv_set *adv_set;
+	const char *str;
+	int i;
+
+	switch (cmd->enable) {
+	case 0x00:
+		str = "Disable";
+		break;
+	case 0x01:
+		str = "Enabled";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+
+	print_field("Ext adv: %s", str);
+
+	if (cmd->num_of_sets == 0) {
+		print_field("Number of sets: Disable all advertising sets");
+	} else if (cmd->num_of_sets > 0x3f) {
+		print_field("Number of sets: Reserved");
+	} else {
+		print_field("Number of sets: %u", cmd->num_of_sets);
+	}
+
+	for (i = 0; i < cmd->num_of_sets; ++i) {
+		adv_set = data + 2 + i * sizeof(struct bt_hci_cmd_ext_adv_set);
+		print_field("Entry %d", i);
+		print_field("  Handle: 0x%2.2x", adv_set->handle);
+		print_field("  Duration: %d ms (0x%2.2x)", adv_set->duration * 10, adv_set->duration);
+		print_field("  Max ext adv events: %d", adv_set->max_events);
+	}
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -7904,7 +7942,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2038, 292, "LE Set Extended Scan Response Data",
 				le_set_ext_scan_rsp_data_cmd, 4, false,
 				status_rsp, 1, true },
-	{ 0x2039, 293, "LE Set Extended Advertising Enable" },
+	{ 0x2039, 293, "LE Set Extended Advertising Enable",
+				le_set_ext_adv_enable_cmd, 2, false,
+				status_rsp, 1, true },
 	{ 0x203a, 294, "LE Read Maximum Advertising Data Length" },
 	{ 0x203b, 295, "LE Read Number of Supported Advertising Sets" },
 	{ 0x203c, 296, "LE Remove Advertising Set" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 08/31] monitor: Add LE Read Maximum Advertising Data Length decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (8 preceding siblings ...)
  2017-06-06  9:40 ` [PATCH BlueZ 07/31] monitor: Add LE Set Extended Advertising Enable decoding Michał Narajowski
@ 2017-06-06  9:40 ` Michał Narajowski
  2017-06-06  9:40 ` [PATCH BlueZ 09/31] monitor: Add LE Read Number of Supported Advertising Sets decoding Michał Narajowski
                   ` (23 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

---
 monitor/bt.h     |  6 ++++++
 monitor/packet.c | 12 +++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index 8dd0d57..b91fbe5 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2234,6 +2234,12 @@ struct bt_hci_cmd_ext_adv_set {
 	uint8_t  max_events;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_READ_MAX_ADV_DATA_LEN			0x203a
+struct bt_hci_rsp_le_read_max_adv_data_len {
+	uint8_t  status;
+	uint16_t  max_len;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index f109b4f..afebf7d 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7221,6 +7221,14 @@ static void le_set_ext_adv_enable_cmd(const void *data, uint8_t size)
 	}
 }
 
+static void le_read_max_adv_data_len_rsp(const void *data, uint8_t size)
+{
+	const struct bt_hci_rsp_le_read_max_adv_data_len *rsp = data;
+
+	print_status(rsp->status);
+	print_field("Max length: %d", rsp->max_len);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -7945,7 +7953,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2039, 293, "LE Set Extended Advertising Enable",
 				le_set_ext_adv_enable_cmd, 2, false,
 				status_rsp, 1, true },
-	{ 0x203a, 294, "LE Read Maximum Advertising Data Length" },
+	{ 0x203a, 294, "LE Read Maximum Advertising Data Length",
+				null_cmd, 0, true,
+				le_read_max_adv_data_len_rsp, 3, true },
 	{ 0x203b, 295, "LE Read Number of Supported Advertising Sets" },
 	{ 0x203c, 296, "LE Remove Advertising Set" },
 	{ 0x203d, 297, "LE Clear Advertising Sets" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 09/31] monitor: Add LE Read Number of Supported Advertising Sets decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (9 preceding siblings ...)
  2017-06-06  9:40 ` [PATCH BlueZ 08/31] monitor: Add LE Read Maximum Advertising Data Length decoding Michał Narajowski
@ 2017-06-06  9:40 ` Michał Narajowski
  2017-06-06  9:40 ` [PATCH BlueZ 10/31] monitor: Add LE Remove Advertising Set decoding Michał Narajowski
                   ` (22 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

---
 monitor/bt.h     |  6 ++++++
 monitor/packet.c | 12 +++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index b91fbe5..ac42cbf 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2240,6 +2240,12 @@ struct bt_hci_rsp_le_read_max_adv_data_len {
 	uint16_t  max_len;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_READ_NUM_SUPPORTED_ADV_SETS			0x203b
+struct bt_hci_rsp_le_read_num_supported_adv_sets {
+	uint8_t  status;
+	uint8_t  num_of_sets;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index afebf7d..214f23e 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7229,6 +7229,14 @@ static void le_read_max_adv_data_len_rsp(const void *data, uint8_t size)
 	print_field("Max length: %d", rsp->max_len);
 }
 
+static void le_read_num_supported_adv_sets_rsp(const void *data, uint8_t size)
+{
+	const struct bt_hci_rsp_le_read_num_supported_adv_sets *rsp = data;
+
+	print_status(rsp->status);
+	print_field("Num supported adv sets: %d", rsp->num_of_sets);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -7956,7 +7964,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x203a, 294, "LE Read Maximum Advertising Data Length",
 				null_cmd, 0, true,
 				le_read_max_adv_data_len_rsp, 3, true },
-	{ 0x203b, 295, "LE Read Number of Supported Advertising Sets" },
+	{ 0x203b, 295, "LE Read Number of Supported Advertising Sets",
+				null_cmd, 0, true,
+				le_read_num_supported_adv_sets_rsp, 2, true },
 	{ 0x203c, 296, "LE Remove Advertising Set" },
 	{ 0x203d, 297, "LE Clear Advertising Sets" },
 	{ 0x203e, 298, "LE Set Periodic Advertising Parameters" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 10/31] monitor: Add LE Remove Advertising Set decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (10 preceding siblings ...)
  2017-06-06  9:40 ` [PATCH BlueZ 09/31] monitor: Add LE Read Number of Supported Advertising Sets decoding Michał Narajowski
@ 2017-06-06  9:40 ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 11/31] monitor: Add LE Clear Advertising Sets decoding Michał Narajowski
                   ` (21 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Remove Advertising Set (0x08|0x003c) plen 1
        Handle: 1
---
 monitor/bt.h     |  5 +++++
 monitor/packet.c | 11 ++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index ac42cbf..365388e 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2246,6 +2246,11 @@ struct bt_hci_rsp_le_read_num_supported_adv_sets {
 	uint8_t  num_of_sets;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_REMOVE_ADV_SET			0x203c
+struct bt_hci_cmd_le_remove_adv_set {
+	uint8_t  handle;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 214f23e..c3dfb47 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7237,6 +7237,13 @@ static void le_read_num_supported_adv_sets_rsp(const void *data, uint8_t size)
 	print_field("Num supported adv sets: %d", rsp->num_of_sets);
 }
 
+static void le_remove_adv_set_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_remove_adv_set *cmd = data;
+
+	print_handle(cmd->handle);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -7967,7 +7974,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x203b, 295, "LE Read Number of Supported Advertising Sets",
 				null_cmd, 0, true,
 				le_read_num_supported_adv_sets_rsp, 2, true },
-	{ 0x203c, 296, "LE Remove Advertising Set" },
+	{ 0x203c, 296, "LE Remove Advertising Set",
+				le_remove_adv_set_cmd, 1, true,
+				status_rsp, 1, true },
 	{ 0x203d, 297, "LE Clear Advertising Sets" },
 	{ 0x203e, 298, "LE Set Periodic Advertising Parameters" },
 	{ 0x203f, 299, "LE Set Periodic Advertising Data" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 11/31] monitor: Add LE Clear Advertising Sets decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (11 preceding siblings ...)
  2017-06-06  9:40 ` [PATCH BlueZ 10/31] monitor: Add LE Remove Advertising Set decoding Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 12/31] monitor: Add LE Set Periodic Advertising Parameters decoding Michał Narajowski
                   ` (20 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

---
 monitor/bt.h     | 2 ++
 monitor/packet.c | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index 365388e..6d2a76e 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2251,6 +2251,8 @@ struct bt_hci_cmd_le_remove_adv_set {
 	uint8_t  handle;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_CLEAR_ADV_SETS			0x203d
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index c3dfb47..9caaeaf 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7977,7 +7977,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x203c, 296, "LE Remove Advertising Set",
 				le_remove_adv_set_cmd, 1, true,
 				status_rsp, 1, true },
-	{ 0x203d, 297, "LE Clear Advertising Sets" },
+	{ 0x203d, 297, "LE Clear Advertising Sets",
+				null_cmd, 0, true,
+				status_rsp, 1, true },
 	{ 0x203e, 298, "LE Set Periodic Advertising Parameters" },
 	{ 0x203f, 299, "LE Set Periodic Advertising Data" },
 	{ 0x2040, 300, "LE Set Periodic Advertising Enable" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 12/31] monitor: Add LE Set Periodic Advertising Parameters decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (12 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 11/31] monitor: Add LE Clear Advertising Sets decoding Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 13/31] monitor: Add LE Set Periodic Advertising Data decoding Michał Narajowski
                   ` (19 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Set Periodic Advertising Parameters (0x08|0x003e) plen 7
        Handle: 1
        Min interval: 2.50 msec (0x0002)
        Max interval: 318.75 msec (0x00ff)
        Properties: 0x00ff
          Include TxPower
          Unknown advertising properties (0x00bf)
---
 monitor/bt.h     |  8 ++++++++
 monitor/packet.c | 42 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index 6d2a76e..c0068ca 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2253,6 +2253,14 @@ struct bt_hci_cmd_le_remove_adv_set {
 
 #define BT_HCI_CMD_LE_CLEAR_ADV_SETS			0x203d
 
+#define BT_HCI_CMD_LE_SET_PERIODIC_ADV_PARAMS			0x203e
+struct bt_hci_cmd_le_set_periodic_adv_params {
+	uint8_t  handle;
+	uint16_t  min_interval;
+	uint16_t  max_interval;
+	uint16_t  properties;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 9caaeaf..7a5b62f 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7244,6 +7244,44 @@ static void le_remove_adv_set_cmd(const void *data, uint8_t size)
 	print_handle(cmd->handle);
 }
 
+static const struct {
+	uint8_t bit;
+	const char *str;
+} periodic_adv_properties_table[] = {
+	{  6, "Include TxPower"		},
+	{ }
+};
+
+static void print_periodic_adv_properties(uint16_t flags)
+{
+	uint16_t mask = flags;
+	int i;
+
+	print_field("Properties: 0x%4.4x", flags);
+
+	for (i = 0; periodic_adv_properties_table[i].str; i++) {
+		if (flags & (1 << periodic_adv_properties_table[i].bit)) {
+			print_field("  %s", periodic_adv_properties_table[i].str);
+			mask &= ~(1 << periodic_adv_properties_table[i].bit);
+		}
+	}
+
+	if (mask)
+		print_text(COLOR_UNKNOWN_ADV_FLAG, "  Unknown advertising properties"
+							" (0x%4.4x)", mask);
+}
+
+
+static void le_set_periodic_adv_params_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_set_periodic_adv_params *cmd = data;
+
+	print_handle(cmd->handle);
+	print_slot_125("Min interval", cmd->min_interval);
+	print_slot_125("Max interval", cmd->max_interval);
+	print_periodic_adv_properties(cmd->properties);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -7980,7 +8018,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x203d, 297, "LE Clear Advertising Sets",
 				null_cmd, 0, true,
 				status_rsp, 1, true },
-	{ 0x203e, 298, "LE Set Periodic Advertising Parameters" },
+	{ 0x203e, 298, "LE Set Periodic Advertising Parameters",
+				le_set_periodic_adv_params_cmd, 7, true,
+				status_rsp, 1, true },
 	{ 0x203f, 299, "LE Set Periodic Advertising Data" },
 	{ 0x2040, 300, "LE Set Periodic Advertising Enable" },
 	{ 0x2041, 301, "LE Set Extended Scan Parameters" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 13/31] monitor: Add LE Set Periodic Advertising Data decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (13 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 12/31] monitor: Add LE Set Periodic Advertising Parameters decoding Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 14/31] monitor: Add LE Set Periodic Advertising Enable decoding Michał Narajowski
                   ` (18 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Set Periodic Advertising Data (0x08|0x003f) plen 7
        Handle: 1
        Handle: 0x01
        Operation: Last fragment
        Data length: 0x04
        ff 00 ff 00                                      ....
---
 monitor/bt.h     |  7 +++++++
 monitor/packet.c | 34 +++++++++++++++++++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index c0068ca..d093162 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2261,6 +2261,13 @@ struct bt_hci_cmd_le_set_periodic_adv_params {
 	uint16_t  properties;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_SET_PERIODIC_ADV_DATA			0x203f
+struct bt_hci_cmd_le_set_periodic_adv_data {
+	uint8_t  handle;
+	uint8_t  operation;
+	uint8_t  data_len;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 7a5b62f..0a1d17c 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7282,6 +7282,36 @@ static void le_set_periodic_adv_params_cmd(const void *data, uint8_t size)
 	print_periodic_adv_properties(cmd->properties);
 }
 
+static void le_set_periodic_adv_data_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_set_periodic_adv_data *cmd = data;
+	const char *str;
+
+	print_handle(cmd->handle);
+
+	print_field("Handle: 0x%2.2x", cmd->handle);
+	switch (cmd->operation) {
+	case 0x00:
+		str = "Immediate fragment";
+		break;
+	case 0x01:
+		str = "First fragment";
+		break;
+	case 0x02:
+		str = "Last fragment";
+		break;
+	case 0x03:
+		str = "Complete ext advertising data";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+	print_field("Operation: %s", str);
+	print_field("Data length: 0x%2.2x", cmd->data_len);
+	packet_hexdump(data + 3, size - 3);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8021,7 +8051,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x203e, 298, "LE Set Periodic Advertising Parameters",
 				le_set_periodic_adv_params_cmd, 7, true,
 				status_rsp, 1, true },
-	{ 0x203f, 299, "LE Set Periodic Advertising Data" },
+	{ 0x203f, 299, "LE Set Periodic Advertising Data",
+				le_set_periodic_adv_data_cmd, 3, false,
+				status_rsp, 1, true },
 	{ 0x2040, 300, "LE Set Periodic Advertising Enable" },
 	{ 0x2041, 301, "LE Set Extended Scan Parameters" },
 	{ 0x2042, 302, "LE Set Extended Scan Enable" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 14/31] monitor: Add LE Set Periodic Advertising Enable decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (14 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 13/31] monitor: Add LE Set Periodic Advertising Data decoding Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 15/31] monitor: Add LE Set Extended Scan Parameters decoding Michał Narajowski
                   ` (17 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Set Periodic Advertising Enable (0x08|0x0040) plen 2
        Enable: Enabled
        Handle: 2
---
 monitor/bt.h     |  6 ++++++
 monitor/packet.c | 25 ++++++++++++++++++++++++-
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index d093162..c44aad7 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2268,6 +2268,12 @@ struct bt_hci_cmd_le_set_periodic_adv_data {
 	uint8_t  data_len;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_SET_PERIODIC_ADV_ENABLE			0x2040
+struct bt_hci_cmd_le_set_periodic_adv_enable {
+	uint8_t  enable;
+	uint8_t  handle;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 0a1d17c..1c113ff 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7312,6 +7312,27 @@ static void le_set_periodic_adv_data_cmd(const void *data, uint8_t size)
 	packet_hexdump(data + 3, size - 3);
 }
 
+static void le_set_periodic_adv_enable_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_set_periodic_adv_enable *cmd = data;
+	const char *str;
+
+	switch (cmd->enable) {
+	case 0x00:
+		str = "Disable";
+		break;
+	case 0x01:
+		str = "Enabled";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+
+	print_field("Enable: %s", str);
+	print_handle(cmd->handle);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8054,7 +8075,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x203f, 299, "LE Set Periodic Advertising Data",
 				le_set_periodic_adv_data_cmd, 3, false,
 				status_rsp, 1, true },
-	{ 0x2040, 300, "LE Set Periodic Advertising Enable" },
+	{ 0x2040, 300, "LE Set Periodic Advertising Enable",
+				le_set_periodic_adv_enable_cmd, 2, true,
+				status_rsp, 1, true },
 	{ 0x2041, 301, "LE Set Extended Scan Parameters" },
 	{ 0x2042, 302, "LE Set Extended Scan Enable" },
 	{ 0x2043, 303, "LE Extended Create Connection" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 15/31] monitor: Add LE Set Extended Scan Parameters decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (15 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 14/31] monitor: Add LE Set Periodic Advertising Enable decoding Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06  9:46   ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 16/31] monitor: Add LE Set Extended Scan Enable decoding Michał Narajowski
                   ` (16 subsequent siblings)
  33 siblings, 1 reply; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Set Extended Scan Parameters (0x08|0x0041) plen 13
        Own address type: Random (0x01)
        Filter policy: Reserved (0x09)
        PHYs: 0x05
          LE 1M
          LE Coded
        Entry 0
          Type: Reserved (0x03)
          Interval: 491.250 msec (0x0312)
          Window: 320.625 msec (0x0201)
        Entry 1
          Type: Active (0x01)
          Interval: 0.625 msec (0x0001)
          Window: 0.625 msec (0x0001)
---
 monitor/bt.h     |  12 +++++++
 monitor/packet.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 111 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index c44aad7..fd61c53 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2274,6 +2274,18 @@ struct bt_hci_cmd_le_set_periodic_adv_enable {
 	uint8_t  handle;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_SET_EXT_SCAN_PARAMS		0x2041
+struct bt_hci_cmd_le_set_ext_scan_params {
+	uint8_t  own_addr_type;
+	uint8_t  filter_policy;
+	uint8_t  num_phys;
+} __attribute__ ((packed));
+struct bt_hci_le_scan_phy {
+	uint8_t  type;
+	uint16_t  interval;
+	uint16_t  window;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 1c113ff..78b780f 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7333,6 +7333,102 @@ static void le_set_periodic_adv_enable_cmd(const void *data, uint8_t size)
 	print_handle(cmd->handle);
 }
 
+static const struct {
+	uint8_t bit;
+	const char *str;
+} ext_scan_phys_table[] = {
+	{  0, "LE 1M"		},
+	{  2, "LE Coded"		},
+	{ }
+};
+
+static int print_ext_scan_phys(uint8_t flags)
+{
+	uint8_t mask = flags;
+	int bits_set = 0;
+	int i;
+
+	print_field("PHYs: 0x%2.2x", flags);
+
+	for (i = 0; ext_scan_phys_table[i].str; i++) {
+		if (flags & (1 << ext_scan_phys_table[i].bit)) {
+			print_field("  %s", ext_scan_phys_table[i].str);
+			mask &= ~(1 << ext_scan_phys_table[i].bit);
+			++bits_set;
+		}
+	}
+
+	if (mask)
+		print_text(COLOR_UNKNOWN_ADV_FLAG, "  Unknown scanning PHYs"
+							" (0x%2.2x)", mask);
+	return bits_set;
+}
+
+static void print_scan_filter_policy(uint8_t policy)
+{
+	const char *str;
+
+	switch (policy) {
+	case 0x00:
+		str = "Accept all advertisement";
+		break;
+	case 0x01:
+		str = "Ignore not in white list";
+		break;
+	case 0x02:
+		str = "Accept all advertisement, inc. directed unresolved RPA";
+		break;
+	case 0x03:
+		str = "Ignore not in white list, exc. directed unresolved RPA";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+
+	print_field("Filter policy: %s (0x%2.2x)", str, policy);
+}
+
+static void print_scan_type(const char* label, uint8_t type)
+{
+	const char *str;
+
+	switch (type) {
+	case 0x00:
+		str = "Passive";
+		break;
+	case 0x01:
+		str = "Active";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+
+	print_field("%s: %s (0x%2.2x)", label, str, type);
+}
+
+static void le_set_ext_scan_params_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_set_ext_scan_params *cmd = data;
+	const struct bt_hci_le_scan_phy *scan_phy;
+	int num_structs;
+	int i;
+
+	print_own_addr_type(cmd->own_addr_type);
+	print_scan_filter_policy(cmd->filter_policy);
+	num_structs = print_ext_scan_phys(cmd->num_phys);
+
+	for (i = 0; i < num_structs; ++i) {
+		print_field("Entry %d", i);
+		scan_phy = data + 3 + i * sizeof(struct bt_hci_le_scan_phy);
+
+		print_scan_type("  Type", scan_phy->type);
+		print_slot_625("  Interval", scan_phy->interval);
+		print_slot_625("  Window", scan_phy->window);
+	}
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8078,7 +8174,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2040, 300, "LE Set Periodic Advertising Enable",
 				le_set_periodic_adv_enable_cmd, 2, true,
 				status_rsp, 1, true },
-	{ 0x2041, 301, "LE Set Extended Scan Parameters" },
+	{ 0x2041, 301, "LE Set Extended Scan Parameters",
+				le_set_ext_scan_params_cmd, 3, false,
+				status_rsp, 1, true },
 	{ 0x2042, 302, "LE Set Extended Scan Enable" },
 	{ 0x2043, 303, "LE Extended Create Connection" },
 	{ 0x2044, 304, "LE Periodic Advertising Create Sync" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 16/31] monitor: Add LE Set Extended Scan Enable decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (16 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 15/31] monitor: Add LE Set Extended Scan Parameters decoding Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 17/31] monitor: Add LE Extended Create Connection decoding Michał Narajowski
                   ` (15 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Set Extended Scan Enable (0x08|0x0042) plen 6
        Extended scan: Enabled
        Filter duplicates: Disabled (0x00)
        Duration: 0 msec (0x0000)
        Period: 0.00 sec (0x0000)
---
 monitor/bt.h     |  8 ++++++++
 monitor/packet.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 62 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index fd61c53..8bc19da 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2286,6 +2286,14 @@ struct bt_hci_le_scan_phy {
 	uint16_t  window;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_SET_EXT_SCAN_ENABLE		0x2042
+struct bt_hci_cmd_le_set_ext_scan_enable {
+	uint8_t  enable;
+	uint8_t  filter_dup;
+	uint16_t  duration;
+	uint16_t  period;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 78b780f..9115395 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7429,6 +7429,57 @@ static void le_set_ext_scan_params_cmd(const void *data, uint8_t size)
 	}
 }
 
+static void print_enable(const char *label, uint8_t enable)
+{
+	const char *str;
+
+	switch (enable) {
+	case 0x00:
+		str = "Disable";
+		break;
+	case 0x01:
+		str = "Enabled";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+
+	print_field("%s: %s", label, str);
+}
+
+static void print_filter_dup(uint8_t filter_dup)
+{
+	const char *str;
+
+	switch (filter_dup) {
+	case 0x00:
+		str = "Disabled";
+		break;
+	case 0x01:
+		str = "Enabled";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+
+	print_field("Filter duplicates: %s (0x%2.2x)", str, filter_dup);
+}
+
+static void le_set_ext_scan_enable_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_set_ext_scan_enable *cmd = data;
+
+	print_enable("Extended scan", cmd->enable);
+	print_filter_dup(cmd->filter_dup);
+
+	print_field("Duration: %d msec (0x%4.4x)",
+			le16_to_cpu(cmd->duration) * 10, le16_to_cpu(cmd->duration));
+	print_field("Period: %.2f sec (0x%4.4x)",
+			le16_to_cpu(cmd->period) * 1.28, le16_to_cpu(cmd->period));
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8177,7 +8228,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2041, 301, "LE Set Extended Scan Parameters",
 				le_set_ext_scan_params_cmd, 3, false,
 				status_rsp, 1, true },
-	{ 0x2042, 302, "LE Set Extended Scan Enable" },
+	{ 0x2042, 302, "LE Set Extended Scan Enable",
+				le_set_ext_scan_enable_cmd, 6, true,
+				status_rsp, 1, true },
 	{ 0x2043, 303, "LE Extended Create Connection" },
 	{ 0x2044, 304, "LE Periodic Advertising Create Sync" },
 	{ 0x2045, 305, "LE Periodic Advertising Create Sync Cancel" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 17/31] monitor: Add LE Extended Create Connection decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (17 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 16/31] monitor: Add LE Set Extended Scan Enable decoding Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 18/31] monitor: Add LE Periodic Advertising Create Sync decoding Michał Narajowski
                   ` (14 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Extended Create Connection (0x08|0x0043) plen 24
        Filter policy: White list is used (0x01)
        Own address type: Public (0x02)
        Peer address type: Reserved (0xff)
        Peer address: 00-00-00-00-00-00
        Initiating PHYs: 0x01
          LE 1M
        Scan interval: 1.250 msec (0x0002)
        Scan window: 1601.875 msec (0x0a03)
        Min connection interval: 3212.50 msec (0x0a0a)
        Max connection interval: 3212.50 msec (0x0a0a)
        Connection latency: 0x010a
        Supervision timeout: 7700 msec (0x0302)
        Min connection length: 802.500 msec (0x0504)
        Max connection length: 5123.750 msec (0x2006)
---
 monitor/bt.h     | 19 ++++++++++++++
 monitor/packet.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 98 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index 8bc19da..d98d4b6 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2294,6 +2294,25 @@ struct bt_hci_cmd_le_set_ext_scan_enable {
 	uint16_t  period;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_EXT_CREATE_CONN		0x2043
+struct bt_hci_cmd_le_ext_create_conn {
+	uint8_t  filter_policy;
+	uint8_t  own_addr_type;
+	uint8_t  peer_addr_type;
+	uint8_t  peer_addr[6];
+	uint8_t  phys;
+} __attribute__ ((packed));
+struct bt_hci_le_ext_create_conn {
+	uint8_t  scan_interval;
+	uint16_t  scan_window;
+	uint16_t  min_interval;
+	uint16_t  max_interval;
+	uint16_t  latency;
+	uint16_t  supv_timeout;
+	uint16_t  min_length;
+	uint16_t  max_length;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 9115395..3278abf 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7480,6 +7480,82 @@ static void le_set_ext_scan_enable_cmd(const void *data, uint8_t size)
 			le16_to_cpu(cmd->period) * 1.28, le16_to_cpu(cmd->period));
 }
 
+static const struct {
+	uint8_t bit;
+	const char *str;
+} ext_conn_phys_table[] = {
+	{  0, "LE 1M"		},
+	{  1, "LE 2M"		},
+	{  2, "LE Coded"		},
+	{ }
+};
+
+static int print_ext_conn_phys(uint8_t flags)
+{
+	uint8_t mask = flags;
+	int bits_set = 0;
+	int i;
+
+	print_field("Initiating PHYs: 0x%2.2x", flags);
+
+	for (i = 0; ext_conn_phys_table[i].str; i++) {
+		if (flags & (1 << ext_conn_phys_table[i].bit)) {
+			print_field("  %s", ext_conn_phys_table[i].str);
+			mask &= ~(1 << ext_conn_phys_table[i].bit);
+			++bits_set;
+		}
+	}
+
+	if (mask)
+		print_text(COLOR_UNKNOWN_ADV_FLAG, "  Unknown scanning PHYs"
+							" (0x%2.2x)", mask);
+	return bits_set;
+}
+
+
+static void le_ext_create_conn_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_ext_create_conn *cmd = data;
+	const struct bt_hci_le_ext_create_conn *entry;
+	const char *str;
+	int num_entries;
+	int i;
+
+	switch (cmd->filter_policy) {
+	case 0x00:
+		str = "White list is not used";
+		break;
+	case 0x01:
+		str = "White list is used";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+
+	print_field("Filter policy: %s (0x%2.2x)", str, cmd->filter_policy);
+
+	print_own_addr_type(cmd->own_addr_type);
+	print_peer_addr_type("Peer address type", cmd->peer_addr_type);
+	print_addr("Peer address", cmd->peer_addr, cmd->peer_addr_type);
+	num_entries = print_ext_conn_phys(cmd->phys);
+
+	for (i = 0; i < num_entries; ++i) {
+		entry = data + 10 + i * sizeof(struct bt_hci_le_ext_create_conn);
+
+		print_slot_625("Scan interval", entry->scan_interval);
+		print_slot_625("Scan window", entry->scan_window);
+		print_slot_125("Min connection interval", entry->min_interval);
+		print_slot_125("Max connection interval", entry->max_interval);
+		print_field("Connection latency: 0x%4.4x", le16_to_cpu(entry->latency));
+		print_field("Supervision timeout: %d msec (0x%4.4x)",
+						le16_to_cpu(entry->supv_timeout) * 10,
+						le16_to_cpu(entry->supv_timeout));
+		print_slot_625("Min connection length", entry->min_length);
+		print_slot_625("Max connection length", entry->max_length);
+	}
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8231,7 +8307,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2042, 302, "LE Set Extended Scan Enable",
 				le_set_ext_scan_enable_cmd, 6, true,
 				status_rsp, 1, true },
-	{ 0x2043, 303, "LE Extended Create Connection" },
+	{ 0x2043, 303, "LE Extended Create Connection",
+				le_ext_create_conn_cmd, 10, false,
+				status_rsp, 1, true },
 	{ 0x2044, 304, "LE Periodic Advertising Create Sync" },
 	{ 0x2045, 305, "LE Periodic Advertising Create Sync Cancel" },
 	{ 0x2046, 306, "LE Periodic Advertising Terminate Sync" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 18/31] monitor: Add LE Periodic Advertising Create Sync decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (18 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 17/31] monitor: Add LE Extended Create Connection decoding Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 19/31] monitor: Add LE Periodic Advertising Create Sync Cancel decoding Michał Narajowski
                   ` (13 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Periodic Advertising Create Sync (0x08|0x0044) plen 14
        Filter policy: Use Periodic Advertiser List (0x01)
        SID: 0x02
        Adv address type: Reserved (0xff)
        Adv address: 00-00-00-00-00-00
        Skip: 0x0201
        Sync timeout: 25630 msec (0x0a03)
        Unused: 0x0a
---
 monitor/bt.h     | 11 +++++++++++
 monitor/packet.c | 32 +++++++++++++++++++++++++++++++-
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index d98d4b6..014cde6 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2313,6 +2313,17 @@ struct bt_hci_le_ext_create_conn {
 	uint16_t  max_length;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_PERIODIC_ADV_CREATE_SYNC		0x2044
+struct bt_hci_cmd_le_periodic_adv_create_sync {
+	uint8_t  filter_policy;
+	uint8_t  sid;
+	uint8_t  addr_type;
+	uint8_t  addr[6];
+	uint16_t  skip;
+	uint16_t  sync_timeout;
+	uint8_t  unused;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 3278abf..273f06f 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7556,6 +7556,34 @@ static void le_ext_create_conn_cmd(const void *data, uint8_t size)
 	}
 }
 
+static void le_periodic_adv_create_sync_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_periodic_adv_create_sync *cmd = data;
+	const char *str;
+
+	switch (cmd->filter_policy) {
+	case 0x00:
+		str = "Use specified advertising parameters";
+		break;
+	case 0x01:
+		str = "Use Periodic Advertiser List";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+
+	print_field("Filter policy: %s (0x%2.2x)", str, cmd->filter_policy);
+	print_field("SID: 0x%2.2x", cmd->sid);
+	print_addr_type("Adv address type", cmd->addr_type);
+	print_addr("Adv address", cmd->addr, cmd->addr_type);
+	print_field("Skip: 0x%4.4x", cmd->skip);
+	print_field("Sync timeout: %d msec (0x%4.4x)",
+					le16_to_cpu(cmd->sync_timeout) * 10,
+					le16_to_cpu(cmd->sync_timeout));
+	print_field("Unused: 0x%2.2x", cmd->unused);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8310,7 +8338,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2043, 303, "LE Extended Create Connection",
 				le_ext_create_conn_cmd, 10, false,
 				status_rsp, 1, true },
-	{ 0x2044, 304, "LE Periodic Advertising Create Sync" },
+	{ 0x2044, 304, "LE Periodic Advertising Create Sync",
+				le_periodic_adv_create_sync_cmd, 14, true,
+				status_rsp, 1, true },
 	{ 0x2045, 305, "LE Periodic Advertising Create Sync Cancel" },
 	{ 0x2046, 306, "LE Periodic Advertising Terminate Sync" },
 	{ 0x2047, 307, "LE Add Device To Periodic Advertiser List" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 19/31] monitor: Add LE Periodic Advertising Create Sync Cancel decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (19 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 18/31] monitor: Add LE Periodic Advertising Create Sync decoding Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 20/31] monitor: Add LE Periodic Advertising Terminate Sync decoding Michał Narajowski
                   ` (12 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

---
 monitor/bt.h     | 2 ++
 monitor/packet.c | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index 014cde6..217e8f1 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2324,6 +2324,8 @@ struct bt_hci_cmd_le_periodic_adv_create_sync {
 	uint8_t  unused;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_PERIODIC_ADV_CREATE_SYNC_CANCEL		0x2045
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 273f06f..678663b 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -8341,7 +8341,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2044, 304, "LE Periodic Advertising Create Sync",
 				le_periodic_adv_create_sync_cmd, 14, true,
 				status_rsp, 1, true },
-	{ 0x2045, 305, "LE Periodic Advertising Create Sync Cancel" },
+	{ 0x2045, 305, "LE Periodic Advertising Create Sync Cancel",
+				null_cmd, 0, true,
+				status_rsp, 1, true },
 	{ 0x2046, 306, "LE Periodic Advertising Terminate Sync" },
 	{ 0x2047, 307, "LE Add Device To Periodic Advertiser List" },
 	{ 0x2048, 308, "LE Remove Device From Periodic Advertiser List" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 20/31] monitor: Add LE Periodic Advertising Terminate Sync decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (20 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 19/31] monitor: Add LE Periodic Advertising Create Sync Cancel decoding Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 21/31] monitor: Add LE Add Device To Periodic Advertiser List decoding Michał Narajowski
                   ` (11 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Periodic Advertising Terminate Sync (0x08|0x0046) plen 2
        Sync handle: 0x0201
---
 monitor/bt.h     |  5 +++++
 monitor/packet.c | 11 ++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index 217e8f1..65c69c0 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2326,6 +2326,11 @@ struct bt_hci_cmd_le_periodic_adv_create_sync {
 
 #define BT_HCI_CMD_LE_PERIODIC_ADV_CREATE_SYNC_CANCEL		0x2045
 
+#define BT_HCI_CMD_LE_PERIODIC_ADV_TERM_SYNC		0x2046
+struct bt_hci_cmd_le_periodic_adv_term_sync {
+	uint16_t  sync_handle;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 678663b..35172f4 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7584,6 +7584,13 @@ static void le_periodic_adv_create_sync_cmd(const void *data, uint8_t size)
 	print_field("Unused: 0x%2.2x", cmd->unused);
 }
 
+static void le_periodic_adv_term_sync_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_periodic_adv_term_sync *cmd = data;
+
+	print_field("Sync handle: 0x%4.4x", cmd->sync_handle);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8344,7 +8351,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2045, 305, "LE Periodic Advertising Create Sync Cancel",
 				null_cmd, 0, true,
 				status_rsp, 1, true },
-	{ 0x2046, 306, "LE Periodic Advertising Terminate Sync" },
+	{ 0x2046, 306, "LE Periodic Advertising Terminate Sync",
+				le_periodic_adv_term_sync_cmd, 2, true,
+				status_rsp, 1, true },
 	{ 0x2047, 307, "LE Add Device To Periodic Advertiser List" },
 	{ 0x2048, 308, "LE Remove Device From Periodic Advertiser List" },
 	{ 0x2049, 309, "LE Clear Periodic Advertiser List" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 21/31] monitor: Add LE Add Device To Periodic Advertiser List decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (21 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 20/31] monitor: Add LE Periodic Advertising Terminate Sync decoding Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 22/31] monitor: Add LE Remove Device From " Michał Narajowski
                   ` (10 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Add Device To Periodic Advertiser List (0x08|0x0047) plen 8
        Adv address type: Random (0x01)
        Adv address: 07:06:05:04:03:02 (Non-Resolvable)
        SID: 0x08
---
 monitor/bt.h     |  7 +++++++
 monitor/packet.c | 13 ++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index 65c69c0..5a932d8 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2331,6 +2331,13 @@ struct bt_hci_cmd_le_periodic_adv_term_sync {
 	uint16_t  sync_handle;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_ADD_DEV_PERIODIC_ADV_LIST		0x2047
+struct bt_hci_cmd_le_add_dev_periodic_adv_list {
+	uint8_t  addr_type;
+	uint8_t  addr[6];
+	uint8_t  sid;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 35172f4..f09c9b1 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7591,6 +7591,15 @@ static void le_periodic_adv_term_sync_cmd(const void *data, uint8_t size)
 	print_field("Sync handle: 0x%4.4x", cmd->sync_handle);
 }
 
+static void le_add_dev_periodic_adv_list_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_add_dev_periodic_adv_list *cmd = data;
+
+	print_addr_type("Adv address type", cmd->addr_type);
+	print_addr("Adv address", cmd->addr, cmd->addr_type);
+	print_field("SID: 0x%2.2x", cmd->sid);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8354,7 +8363,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2046, 306, "LE Periodic Advertising Terminate Sync",
 				le_periodic_adv_term_sync_cmd, 2, true,
 				status_rsp, 1, true },
-	{ 0x2047, 307, "LE Add Device To Periodic Advertiser List" },
+	{ 0x2047, 307, "LE Add Device To Periodic Advertiser List",
+				le_add_dev_periodic_adv_list_cmd, 8, true,
+				status_rsp, 1, true },
 	{ 0x2048, 308, "LE Remove Device From Periodic Advertiser List" },
 	{ 0x2049, 309, "LE Clear Periodic Advertiser List" },
 	{ 0x204a, 310, "LE Read Periodic Advertiser List Size" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 22/31] monitor: Add LE Remove Device From Periodic Advertiser List decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (22 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 21/31] monitor: Add LE Add Device To Periodic Advertiser List decoding Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 23/31] monitor: Add LE Clear " Michał Narajowski
                   ` (9 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Add Device To Periodic Advertiser List (0x08|0x0047) plen 8
        Adv address type: Random (0x01)
        Adv address: 07:06:05:04:03:02 (Non-Resolvable)
        SID: 0x08
---
 monitor/bt.h     |  7 +++++++
 monitor/packet.c | 13 ++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index 5a932d8..78f2f57 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2338,6 +2338,13 @@ struct bt_hci_cmd_le_add_dev_periodic_adv_list {
 	uint8_t  sid;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_REMOVE_DEV_PERIODIC_ADV_LIST		0x2048
+struct bt_hci_cmd_le_remove_dev_periodic_adv_list {
+	uint8_t  addr_type;
+	uint8_t  addr[6];
+	uint8_t  sid;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index f09c9b1..455f490 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7600,6 +7600,15 @@ static void le_add_dev_periodic_adv_list_cmd(const void *data, uint8_t size)
 	print_field("SID: 0x%2.2x", cmd->sid);
 }
 
+static void le_remove_dev_periodic_adv_list_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_remove_dev_periodic_adv_list *cmd = data;
+
+	print_addr_type("Adv address type", cmd->addr_type);
+	print_addr("Adv address", cmd->addr, cmd->addr_type);
+	print_field("SID: 0x%2.2x", cmd->sid);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8366,7 +8375,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2047, 307, "LE Add Device To Periodic Advertiser List",
 				le_add_dev_periodic_adv_list_cmd, 8, true,
 				status_rsp, 1, true },
-	{ 0x2048, 308, "LE Remove Device From Periodic Advertiser List" },
+	{ 0x2048, 308, "LE Remove Device From Periodic Advertiser List",
+				le_remove_dev_periodic_adv_list_cmd, 8, true,
+				status_rsp, 1, true },
 	{ 0x2049, 309, "LE Clear Periodic Advertiser List" },
 	{ 0x204a, 310, "LE Read Periodic Advertiser List Size" },
 	{ 0x204b, 311, "LE Read Transmit Power" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 23/31] monitor: Add LE Clear Periodic Advertiser List decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (23 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 22/31] monitor: Add LE Remove Device From " Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 24/31] monitor: Add LE Read Periodic Advertiser List Size decoding Michał Narajowski
                   ` (8 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

---
 monitor/bt.h     | 2 ++
 monitor/packet.c | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index 78f2f57..11ba897 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2345,6 +2345,8 @@ struct bt_hci_cmd_le_remove_dev_periodic_adv_list {
 	uint8_t  sid;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_CLEAR_PERIODIC_ADV_LIST		0x2049
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 455f490..d7dd913 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -8378,7 +8378,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2048, 308, "LE Remove Device From Periodic Advertiser List",
 				le_remove_dev_periodic_adv_list_cmd, 8, true,
 				status_rsp, 1, true },
-	{ 0x2049, 309, "LE Clear Periodic Advertiser List" },
+	{ 0x2049, 309, "LE Clear Periodic Advertiser List",
+				null_cmd, 0, true,
+				status_rsp, 1, true },
 	{ 0x204a, 310, "LE Read Periodic Advertiser List Size" },
 	{ 0x204b, 311, "LE Read Transmit Power" },
 	{ 0x204c, 312, "LE Read RF Path Compensation" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 24/31] monitor: Add LE Read Periodic Advertiser List Size decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (24 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 23/31] monitor: Add LE Clear " Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 25/31] monitor: Add LE Read Transmit Power decoding Michał Narajowski
                   ` (7 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

---
 monitor/bt.h     |  6 ++++++
 monitor/packet.c | 12 +++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index 11ba897..df89ea7 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2347,6 +2347,12 @@ struct bt_hci_cmd_le_remove_dev_periodic_adv_list {
 
 #define BT_HCI_CMD_LE_CLEAR_PERIODIC_ADV_LIST		0x2049
 
+#define BT_HCI_CMD_LE_READ_PERIODIC_ADV_LIST_SIZE		0x204a
+struct bt_hci_rsp_le_read_dev_periodic_adv_list_size {
+	uint8_t  status;
+	uint8_t  list_size;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index d7dd913..64847fa 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7609,6 +7609,14 @@ static void le_remove_dev_periodic_adv_list_cmd(const void *data, uint8_t size)
 	print_field("SID: 0x%2.2x", cmd->sid);
 }
 
+static void le_read_periodic_adv_list_size_rsp(const void *data, uint8_t size)
+{
+	const struct bt_hci_rsp_le_read_dev_periodic_adv_list_size *rsp = data;
+
+	print_status(rsp->status);
+	print_field("List size: 0x%2.2x", rsp->list_size);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8381,7 +8389,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2049, 309, "LE Clear Periodic Advertiser List",
 				null_cmd, 0, true,
 				status_rsp, 1, true },
-	{ 0x204a, 310, "LE Read Periodic Advertiser List Size" },
+	{ 0x204a, 310, "LE Read Periodic Advertiser List Size",
+				null_cmd, 0, true,
+				le_read_periodic_adv_list_size_rsp, 2, true },
 	{ 0x204b, 311, "LE Read Transmit Power" },
 	{ 0x204c, 312, "LE Read RF Path Compensation" },
 	{ 0x204d, 313, "LE Write RF Path Compensation" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 25/31] monitor: Add LE Read Transmit Power decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (25 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 24/31] monitor: Add LE Read Periodic Advertiser List Size decoding Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 26/31] monitor: Add LE Read RF Path Compensation decoding Michał Narajowski
                   ` (6 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

---
 monitor/bt.h     |  7 +++++++
 monitor/packet.c | 13 ++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index df89ea7..8447868 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2353,6 +2353,13 @@ struct bt_hci_rsp_le_read_dev_periodic_adv_list_size {
 	uint8_t  list_size;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_READ_TX_POWER		0x204b
+struct bt_hci_rsp_le_read_tx_power {
+	uint8_t  status;
+	uint8_t  min_tx_power;
+	uint8_t  max_tx_power;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 64847fa..0d2a012 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7617,6 +7617,15 @@ static void le_read_periodic_adv_list_size_rsp(const void *data, uint8_t size)
 	print_field("List size: 0x%2.2x", rsp->list_size);
 }
 
+static void le_read_tx_power_rsp(const void *data, uint8_t size)
+{
+	const struct bt_hci_rsp_le_read_tx_power *rsp = data;
+
+	print_status(rsp->status);
+	print_field("Min Tx power: %d dBm", rsp->min_tx_power);
+	print_field("Max Tx power: %d dBm", rsp->max_tx_power);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8392,7 +8401,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x204a, 310, "LE Read Periodic Advertiser List Size",
 				null_cmd, 0, true,
 				le_read_periodic_adv_list_size_rsp, 2, true },
-	{ 0x204b, 311, "LE Read Transmit Power" },
+	{ 0x204b, 311, "LE Read Transmit Power",
+				null_cmd, 0, true,
+				le_read_tx_power_rsp, 3, true },
 	{ 0x204c, 312, "LE Read RF Path Compensation" },
 	{ 0x204d, 313, "LE Write RF Path Compensation" },
 	{ 0x204e, 314, "LE Set Privacy Mode" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 26/31] monitor: Add LE Read RF Path Compensation decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (26 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 25/31] monitor: Add LE Read Transmit Power decoding Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 27/31] monitor: Add LE Write " Michał Narajowski
                   ` (5 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

---
 monitor/bt.h     |  7 +++++++
 monitor/packet.c | 13 ++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index 8447868..f7969cc 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2360,6 +2360,13 @@ struct bt_hci_rsp_le_read_tx_power {
 	uint8_t  max_tx_power;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_READ_RF_PATH_COMPENSATION		0x204c
+struct bt_hci_rsp_le_read_rf_path_comp {
+	uint8_t  status;
+	uint16_t  rf_tx_path_comp;
+	uint16_t  rf_rx_path_comp;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 0d2a012..31a6c76 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7626,6 +7626,15 @@ static void le_read_tx_power_rsp(const void *data, uint8_t size)
 	print_field("Max Tx power: %d dBm", rsp->max_tx_power);
 }
 
+static void le_read_rf_path_comp_rsp(const void *data, uint8_t size)
+{
+	const struct bt_hci_rsp_le_read_rf_path_comp *rsp = data;
+
+	print_status(rsp->status);
+	print_field("RF Tx Path Compensation Value: 0x%4.4x", rsp->rf_tx_path_comp);
+	print_field("RF Rx Path Compensation Value: 0x%4.4x", rsp->rf_rx_path_comp);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8404,7 +8413,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x204b, 311, "LE Read Transmit Power",
 				null_cmd, 0, true,
 				le_read_tx_power_rsp, 3, true },
-	{ 0x204c, 312, "LE Read RF Path Compensation" },
+	{ 0x204c, 312, "LE Read RF Path Compensation",
+				null_cmd, 0, true,
+				le_read_rf_path_comp_rsp, 5, true },
 	{ 0x204d, 313, "LE Write RF Path Compensation" },
 	{ 0x204e, 314, "LE Set Privacy Mode" },
 	{ }
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 27/31] monitor: Add LE Write RF Path Compensation decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (27 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 26/31] monitor: Add LE Read RF Path Compensation decoding Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 28/31] monitor: Add LE Set Privacy Mode decoding Michał Narajowski
                   ` (4 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Write RF Path Compensation (0x08|0x004d) plen 4
        RF Tx Path Compensation Value: 0x0201
        RF Rx Path Compensation Value: 0x0403
---
 monitor/bt.h     |  6 ++++++
 monitor/packet.c | 12 +++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index f7969cc..8b58795 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2367,6 +2367,12 @@ struct bt_hci_rsp_le_read_rf_path_comp {
 	uint16_t  rf_rx_path_comp;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_WRITE_RF_PATH_COMPENSATION		0x204d
+struct bt_hci_cmd_le_write_rf_path_comp {
+	uint16_t  rf_tx_path_comp;
+	uint16_t  rf_rx_path_comp;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 31a6c76..4b0c5df 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7635,6 +7635,14 @@ static void le_read_rf_path_comp_rsp(const void *data, uint8_t size)
 	print_field("RF Rx Path Compensation Value: 0x%4.4x", rsp->rf_rx_path_comp);
 }
 
+static void le_write_rf_path_comp_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_write_rf_path_comp *cmd = data;
+
+	print_field("RF Tx Path Compensation Value: 0x%4.4x", cmd->rf_tx_path_comp);
+	print_field("RF Rx Path Compensation Value: 0x%4.4x", cmd->rf_rx_path_comp);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8416,7 +8424,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x204c, 312, "LE Read RF Path Compensation",
 				null_cmd, 0, true,
 				le_read_rf_path_comp_rsp, 5, true },
-	{ 0x204d, 313, "LE Write RF Path Compensation" },
+	{ 0x204d, 313, "LE Write RF Path Compensation",
+				le_write_rf_path_comp_cmd, 4, true,
+				status_rsp, 1, true },
 	{ 0x204e, 314, "LE Set Privacy Mode" },
 	{ }
 };
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 28/31] monitor: Add LE Set Privacy Mode decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (28 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 27/31] monitor: Add LE Write " Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 29/31] monitor: Add LE Extended Advertising Report Event decoding Michał Narajowski
                   ` (3 subsequent siblings)
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

< HCI Command: LE Set Privacy Mode (0x08|0x004e) plen 8
        Peer Identity address type: Random (0x01)
        Peer Identity address: 07:06:05:04:03:02 (Non-Resolvable)
        Privacy Mode: Reserved (0x08)
---
 monitor/bt.h     |  7 +++++++
 monitor/packet.c | 27 ++++++++++++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index 8b58795..3e88d36 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2373,6 +2373,13 @@ struct bt_hci_cmd_le_write_rf_path_comp {
 	uint16_t  rf_rx_path_comp;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_SET_PRIV_MODE		0x204e
+struct bt_hci_cmd_le_set_priv_mode {
+	uint8_t  peer_id_addr_type;
+	uint8_t  peer_id_addr[6];
+	uint8_t  priv_mode;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 4b0c5df..dbb920f 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7643,6 +7643,29 @@ static void le_write_rf_path_comp_cmd(const void *data, uint8_t size)
 	print_field("RF Rx Path Compensation Value: 0x%4.4x", cmd->rf_rx_path_comp);
 }
 
+static void le_set_priv_mode_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_set_priv_mode *cmd = data;
+	const char *str;
+
+	print_addr_type("Peer Identity address type", cmd->peer_id_addr_type);
+	print_addr("Peer Identity address", cmd->peer_id_addr, cmd->peer_id_addr_type);
+
+	switch (cmd->priv_mode) {
+	case 0x00:
+		str = "Use Network Privacy";
+		break;
+	case 0x01:
+		str = "Use Device Privacy";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+
+	print_field("Privacy Mode: %s (0x%2.2x)", str, cmd->priv_mode);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8427,7 +8450,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x204d, 313, "LE Write RF Path Compensation",
 				le_write_rf_path_comp_cmd, 4, true,
 				status_rsp, 1, true },
-	{ 0x204e, 314, "LE Set Privacy Mode" },
+	{ 0x204e, 314, "LE Set Privacy Mode",
+				le_set_priv_mode_cmd, 8, true,
+				status_rsp, 1, true },
 	{ }
 };
 
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 29/31] monitor: Add LE Extended Advertising Report Event decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (29 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 28/31] monitor: Add LE Set Privacy Mode decoding Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06 14:10   ` Łukasz Rymanowski
  2017-06-06  9:41 ` [PATCH BlueZ 30/31] monitor: Add LE Advertising Set Terminated " Michał Narajowski
                   ` (2 subsequent siblings)
  33 siblings, 1 reply; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

---
 monitor/bt.h     | 19 ++++++++++++
 monitor/packet.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 103 insertions(+), 5 deletions(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index 3e88d36..f9bdf44 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2990,6 +2990,25 @@ struct bt_hci_evt_le_phy_update_complete {
 	uint8_t  rx_phy;
 } __attribute__ ((packed));
 
+#define BT_HCI_EVT_LE_EXT_ADV_REPORT	0x0d
+struct bt_hci_evt_le_ext_adv_report {
+	uint8_t  num_reports;
+} __attribute__ ((packed));
+struct bt_hci_le_ext_adv_report {
+	uint8_t  event_type;
+	uint8_t  addr_type;
+	uint8_t  addr[6];
+	uint8_t  primary_phy;
+	uint8_t  secondary_phy;
+	uint8_t  sid;
+	uint8_t  tx_power;
+	int8_t   rssi;
+	uint16_t interval;
+	uint8_t  direct_addr_type;
+	uint8_t  direct_addr[6];
+	uint8_t  data_len;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_LE_CHAN_SELECT_ALG		0x14
 struct bt_hci_evt_le_chan_select_alg {
 	uint16_t handle;
diff --git a/monitor/packet.c b/monitor/packet.c
index dbb920f..5e4f081 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -2304,7 +2304,7 @@ static void print_num_reports(uint8_t num_reports)
 	print_field("Num reports: %d", num_reports);
 }
 
-static void print_adv_event_type(uint8_t type)
+static void print_adv_event_type(const char *label, uint8_t type)
 {
 	const char *str;
 
@@ -2329,7 +2329,7 @@ static void print_adv_event_type(uint8_t type)
 		break;
 	}
 
-	print_field("Event type: %s (0x%2.2x)", str, type);
+	print_field("%s: %s (0x%2.2x)", label, str, type);
 }
 
 static void print_rssi(int8_t rssi)
@@ -9417,7 +9417,7 @@ static void le_adv_report_evt(const void *data, uint8_t size)
 	print_num_reports(evt->num_reports);
 
 report:
-	print_adv_event_type(evt->event_type);
+	print_adv_event_type("Event type", evt->event_type);
 	print_peer_addr_type("Address type", evt->addr_type);
 	print_addr("Address", evt->addr, evt->addr_type);
 	print_field("Data length: %d", evt->data_len);
@@ -9535,7 +9535,7 @@ static void le_direct_adv_report_evt(const void *data, uint8_t size)
 
 	print_num_reports(evt->num_reports);
 
-	print_adv_event_type(evt->event_type);
+	print_adv_event_type("Event type", evt->event_type);
 	print_peer_addr_type("Address type", evt->addr_type);
 	print_addr("Address", evt->addr, evt->addr_type);
 	print_addr_type("Direct address type", evt->direct_addr_type);
@@ -9556,6 +9556,84 @@ static void le_phy_update_complete_evt(const void *data, uint8_t size)
 	print_le_phy("RX PHY", evt->rx_phy);
 }
 
+static void le_ext_adv_report_evt(const void *data, uint8_t size)
+{
+	const struct bt_hci_evt_le_ext_adv_report *evt = data;
+	const struct bt_hci_le_ext_adv_report *report;
+	const char *str;
+	int i;
+
+	print_num_reports(evt->num_reports);
+
+	data += sizeof(evt->num_reports);
+
+	for (i = 0; i < evt->num_reports; ++i) {
+		report = data;
+		print_field("Entry %d", i);
+		print_adv_event_type("  Event type", report->event_type);
+		print_peer_addr_type("  Address type", report->addr_type);
+		print_addr("  Address", report->addr, report->addr_type);
+
+		switch (report->primary_phy) {
+		case 0x01:
+			str = "LE 1M";
+			break;
+		case 0x03:
+			str = "LE Coded";
+			break;
+		default:
+			str = "Reserved";
+			break;
+		}
+
+		print_field("  Primary PHY: %s", str);
+
+		switch (report->secondary_phy) {
+		case 0x00:
+			str = "No packets";
+			break;
+		case 0x01:
+			str = "LE 1M";
+			break;
+		case 0x02:
+			str = "LE 2M";
+			break;
+		case 0x03:
+			str = "LE Coded";
+			break;
+		default:
+			str = "Reserved";
+			break;
+		}
+
+		print_field("  Secondary PHY: %s", str);
+
+		if (report->sid == 0xff)
+			print_field("  SID: no ADI field (0x%2.2x)", report->sid);
+		else if (report->sid > 0x0f)
+			print_field("  SID: Reserved (0x%2.2x)", report->sid);
+		else
+			print_field("  SID: 0x%2.2x", report->sid);
+
+		print_field("  TX power: %d dBm", report->tx_power);
+
+		if (report->rssi == 127)
+			print_field("  RSSI: not available (0x%2.2x)", (uint8_t) report->rssi);
+		else if (report->rssi >= -127 && report->rssi <= 20)
+			print_field("  RSSI: %d dBm (0x%2.2x)", report->rssi, (uint8_t) report->rssi);
+		else
+			print_field("  RSSI: reserved (0x%2.2x)", (uint8_t) report->rssi);
+
+		print_slot_125("  Periodic advertising invteral", report->interval);
+		print_peer_addr_type("  Direct address type", report->direct_addr_type);
+		print_addr("  Direct address", report->direct_addr, report->direct_addr_type);
+		print_field("  Data length: 0x%2.2x", report->data_len);
+		data += sizeof(struct bt_hci_le_ext_adv_report);
+		packet_hexdump(data, report->data_len);
+		data += report->data_len;
+	}
+}
+
 static void le_chan_select_alg_evt(const void *data, uint8_t size)
 {
 	const struct bt_hci_evt_le_chan_select_alg *evt = data;
@@ -9646,7 +9724,8 @@ static const struct subevent_data le_meta_event_table[] = {
 				le_direct_adv_report_evt, 1, false },
 	{ 0x0c, "LE PHY Update Complete",
 				le_phy_update_complete_evt, 5, true},
-	{ 0x0d, "LE Extended Advertising Report" },
+	{ 0x0d, "LE Extended Advertising Report",
+				le_ext_adv_report_evt, 1, false},
 	{ 0x0e, "LE Periodic Advertising Sync Established" },
 	{ 0x0f, "LE Periodic Advertising Report" },
 	{ 0x10, "LE Periodic Advertising Sync Lost" },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 30/31] monitor: Add LE Advertising Set Terminated Event decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (30 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 29/31] monitor: Add LE Extended Advertising Report Event decoding Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-06  9:41 ` [PATCH BlueZ 31/31] monitor: Add LE Scan Request Received " Michał Narajowski
  2017-06-08  8:47 ` [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Marcel Holtmann
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

---
 monitor/bt.h     |  8 ++++++++
 monitor/packet.c | 14 +++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index f9bdf44..251b793 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -3009,6 +3009,14 @@ struct bt_hci_le_ext_adv_report {
 	uint8_t  data_len;
 } __attribute__ ((packed));
 
+#define BT_HCI_EVT_LE_ADV_SET_TERM		0x12
+struct bt_hci_evt_le_adv_set_term {
+	uint8_t  status;
+	uint8_t  handle;
+	uint16_t conn_handle;
+	uint8_t  num_evts;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_LE_CHAN_SELECT_ALG		0x14
 struct bt_hci_evt_le_chan_select_alg {
 	uint16_t handle;
diff --git a/monitor/packet.c b/monitor/packet.c
index 5e4f081..114d101 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -9634,6 +9634,17 @@ static void le_ext_adv_report_evt(const void *data, uint8_t size)
 	}
 }
 
+static void le_adv_set_term_evt(const void *data, uint8_t size)
+{
+	const struct bt_hci_evt_le_adv_set_term *evt = data;
+
+	print_status(evt->status);
+	print_field("Handle: %d", evt->handle);
+	print_field("Connection handle: %d", evt->conn_handle);
+	print_field("Number of completed extended advertising events: %d",
+			evt->num_evts);
+}
+
 static void le_chan_select_alg_evt(const void *data, uint8_t size)
 {
 	const struct bt_hci_evt_le_chan_select_alg *evt = data;
@@ -9730,7 +9741,8 @@ static const struct subevent_data le_meta_event_table[] = {
 	{ 0x0f, "LE Periodic Advertising Report" },
 	{ 0x10, "LE Periodic Advertising Sync Lost" },
 	{ 0x11, "LE Scan Timeout" },
-	{ 0x12, "LE Advertising Set Terminated" },
+	{ 0x12, "LE Advertising Set Terminated",
+				le_adv_set_term_evt, 5, true},
 	{ 0x13, "LE Scan Request Received" },
 	{ 0x14, "LE Channel Selection Algorithm",
 				le_chan_select_alg_evt, 3, true},
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH BlueZ 31/31] monitor: Add LE Scan Request Received Event decoding
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (31 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 30/31] monitor: Add LE Advertising Set Terminated " Michał Narajowski
@ 2017-06-06  9:41 ` Michał Narajowski
  2017-06-08  8:47 ` [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Marcel Holtmann
  33 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

---
 monitor/bt.h     |  7 +++++++
 monitor/packet.c | 12 +++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index 251b793..2e4ded7 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -3017,6 +3017,13 @@ struct bt_hci_evt_le_adv_set_term {
 	uint8_t  num_evts;
 } __attribute__ ((packed));
 
+#define BT_HCI_EVT_LE_SCAN_REQ_RECEIVED		0x13
+struct bt_hci_evt_le_scan_req_received {
+	uint8_t  handle;
+	uint8_t  scanner_addr_type;
+	uint8_t  scanner_addr[6];
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_LE_CHAN_SELECT_ALG		0x14
 struct bt_hci_evt_le_chan_select_alg {
 	uint16_t handle;
diff --git a/monitor/packet.c b/monitor/packet.c
index 114d101..6a5ea02 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -9645,6 +9645,15 @@ static void le_adv_set_term_evt(const void *data, uint8_t size)
 			evt->num_evts);
 }
 
+static void le_scan_req_received_evt(const void *data, uint8_t size)
+{
+	const struct bt_hci_evt_le_scan_req_received *evt = data;
+
+	print_field("Handle: %d", evt->handle);
+	print_peer_addr_type("Scanner ddress type", evt->scanner_addr_type);
+	print_addr("Scanner address", evt->scanner_addr, evt->scanner_addr_type);
+}
+
 static void le_chan_select_alg_evt(const void *data, uint8_t size)
 {
 	const struct bt_hci_evt_le_chan_select_alg *evt = data;
@@ -9743,7 +9752,8 @@ static const struct subevent_data le_meta_event_table[] = {
 	{ 0x11, "LE Scan Timeout" },
 	{ 0x12, "LE Advertising Set Terminated",
 				le_adv_set_term_evt, 5, true},
-	{ 0x13, "LE Scan Request Received" },
+	{ 0x13, "LE Scan Request Received",
+				le_scan_req_received_evt, 8, true},
 	{ 0x14, "LE Channel Selection Algorithm",
 				le_chan_select_alg_evt, 3, true},
 	{ }
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* Re: [PATCH BlueZ 15/31] monitor: Add LE Set Extended Scan Parameters decoding
  2017-06-06  9:41 ` [PATCH BlueZ 15/31] monitor: Add LE Set Extended Scan Parameters decoding Michał Narajowski
@ 2017-06-06  9:46   ` Michał Narajowski
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Narajowski @ 2017-06-06  9:46 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Michał Narajowski

Sent by mistake. This is part of the set as 15/31 and 16/31.

2017-06-06 11:41 GMT+02:00 Micha=C5=82 Narajowski <michal.narajowski@codeco=
up.pl>:
> < HCI Command: LE Set Extended Scan Parameters (0x08|0x0041) plen 13
>         Own address type: Random (0x01)
>         Filter policy: Reserved (0x09)
>         PHYs: 0x05
>           LE 1M
>           LE Coded
>         Entry 0
>           Type: Reserved (0x03)
>           Interval: 491.250 msec (0x0312)
>           Window: 320.625 msec (0x0201)
>         Entry 1
>           Type: Active (0x01)
>           Interval: 0.625 msec (0x0001)
>           Window: 0.625 msec (0x0001)
> ---
>  monitor/bt.h     |  12 +++++++
>  monitor/packet.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++++=
+++++-
>  2 files changed, 111 insertions(+), 1 deletion(-)
>
> diff --git a/monitor/bt.h b/monitor/bt.h
> index c44aad7..fd61c53 100644
> --- a/monitor/bt.h
> +++ b/monitor/bt.h
> @@ -2274,6 +2274,18 @@ struct bt_hci_cmd_le_set_periodic_adv_enable {
>         uint8_t  handle;
>  } __attribute__ ((packed));
>
> +#define BT_HCI_CMD_LE_SET_EXT_SCAN_PARAMS              0x2041
> +struct bt_hci_cmd_le_set_ext_scan_params {
> +       uint8_t  own_addr_type;
> +       uint8_t  filter_policy;
> +       uint8_t  num_phys;
> +} __attribute__ ((packed));
> +struct bt_hci_le_scan_phy {
> +       uint8_t  type;
> +       uint16_t  interval;
> +       uint16_t  window;
> +} __attribute__ ((packed));
> +
>  #define BT_HCI_EVT_INQUIRY_COMPLETE            0x01
>  struct bt_hci_evt_inquiry_complete {
>         uint8_t  status;
> diff --git a/monitor/packet.c b/monitor/packet.c
> index 1c113ff..78b780f 100644
> --- a/monitor/packet.c
> +++ b/monitor/packet.c
> @@ -7333,6 +7333,102 @@ static void le_set_periodic_adv_enable_cmd(const =
void *data, uint8_t size)
>         print_handle(cmd->handle);
>  }
>
> +static const struct {
> +       uint8_t bit;
> +       const char *str;
> +} ext_scan_phys_table[] =3D {
> +       {  0, "LE 1M"           },
> +       {  2, "LE Coded"                },
> +       { }
> +};
> +
> +static int print_ext_scan_phys(uint8_t flags)
> +{
> +       uint8_t mask =3D flags;
> +       int bits_set =3D 0;
> +       int i;
> +
> +       print_field("PHYs: 0x%2.2x", flags);
> +
> +       for (i =3D 0; ext_scan_phys_table[i].str; i++) {
> +               if (flags & (1 << ext_scan_phys_table[i].bit)) {
> +                       print_field("  %s", ext_scan_phys_table[i].str);
> +                       mask &=3D ~(1 << ext_scan_phys_table[i].bit);
> +                       ++bits_set;
> +               }
> +       }
> +
> +       if (mask)
> +               print_text(COLOR_UNKNOWN_ADV_FLAG, "  Unknown scanning PH=
Ys"
> +                                                       " (0x%2.2x)", mas=
k);
> +       return bits_set;
> +}
> +
> +static void print_scan_filter_policy(uint8_t policy)
> +{
> +       const char *str;
> +
> +       switch (policy) {
> +       case 0x00:
> +               str =3D "Accept all advertisement";
> +               break;
> +       case 0x01:
> +               str =3D "Ignore not in white list";
> +               break;
> +       case 0x02:
> +               str =3D "Accept all advertisement, inc. directed unresolv=
ed RPA";
> +               break;
> +       case 0x03:
> +               str =3D "Ignore not in white list, exc. directed unresolv=
ed RPA";
> +               break;
> +       default:
> +               str =3D "Reserved";
> +               break;
> +       }
> +
> +       print_field("Filter policy: %s (0x%2.2x)", str, policy);
> +}
> +
> +static void print_scan_type(const char* label, uint8_t type)
> +{
> +       const char *str;
> +
> +       switch (type) {
> +       case 0x00:
> +               str =3D "Passive";
> +               break;
> +       case 0x01:
> +               str =3D "Active";
> +               break;
> +       default:
> +               str =3D "Reserved";
> +               break;
> +       }
> +
> +       print_field("%s: %s (0x%2.2x)", label, str, type);
> +}
> +
> +static void le_set_ext_scan_params_cmd(const void *data, uint8_t size)
> +{
> +       const struct bt_hci_cmd_le_set_ext_scan_params *cmd =3D data;
> +       const struct bt_hci_le_scan_phy *scan_phy;
> +       int num_structs;
> +       int i;
> +
> +       print_own_addr_type(cmd->own_addr_type);
> +       print_scan_filter_policy(cmd->filter_policy);
> +       num_structs =3D print_ext_scan_phys(cmd->num_phys);
> +
> +       for (i =3D 0; i < num_structs; ++i) {
> +               print_field("Entry %d", i);
> +               scan_phy =3D data + 3 + i * sizeof(struct bt_hci_le_scan_=
phy);
> +
> +               print_scan_type("  Type", scan_phy->type);
> +               print_slot_625("  Interval", scan_phy->interval);
> +               print_slot_625("  Window", scan_phy->window);
> +       }
> +}
> +
>  struct opcode_data {
>         uint16_t opcode;
>         int bit;
> @@ -8078,7 +8174,9 @@ static const struct opcode_data opcode_table[] =3D =
{
>         { 0x2040, 300, "LE Set Periodic Advertising Enable",
>                                 le_set_periodic_adv_enable_cmd, 2, true,
>                                 status_rsp, 1, true },
> -       { 0x2041, 301, "LE Set Extended Scan Parameters" },
> +       { 0x2041, 301, "LE Set Extended Scan Parameters",
> +                               le_set_ext_scan_params_cmd, 3, false,
> +                               status_rsp, 1, true },
>         { 0x2042, 302, "LE Set Extended Scan Enable" },
>         { 0x2043, 303, "LE Extended Create Connection" },
>         { 0x2044, 304, "LE Periodic Advertising Create Sync" },
> --
> 2.9.3
>

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH BlueZ 29/31] monitor: Add LE Extended Advertising Report Event decoding
  2017-06-06  9:41 ` [PATCH BlueZ 29/31] monitor: Add LE Extended Advertising Report Event decoding Michał Narajowski
@ 2017-06-06 14:10   ` Łukasz Rymanowski
  0 siblings, 0 replies; 40+ messages in thread
From: Łukasz Rymanowski @ 2017-06-06 14:10 UTC (permalink / raw)
  To: Michał Narajowski; +Cc: linux-bluetooth@vger.kernel.org

Hi Micha=C5=82,

On 6 June 2017 at 11:41, Micha=C5=82 Narajowski
<michal.narajowski@codecoup.pl> wrote:
>
> ---
>  monitor/bt.h     | 19 ++++++++++++
>  monitor/packet.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++=
++----
>  2 files changed, 103 insertions(+), 5 deletions(-)
>
> diff --git a/monitor/bt.h b/monitor/bt.h
> index 3e88d36..f9bdf44 100644
> --- a/monitor/bt.h
> +++ b/monitor/bt.h
> @@ -2990,6 +2990,25 @@ struct bt_hci_evt_le_phy_update_complete {
>         uint8_t  rx_phy;
>  } __attribute__ ((packed));
>
> +#define BT_HCI_EVT_LE_EXT_ADV_REPORT   0x0d
> +struct bt_hci_evt_le_ext_adv_report {
> +       uint8_t  num_reports;
> +} __attribute__ ((packed));
> +struct bt_hci_le_ext_adv_report {
> +       uint8_t  event_type;


event type is 16 bits long and it needs legacy decoding.

>
> +       uint8_t  addr_type;
> +       uint8_t  addr[6];
> +       uint8_t  primary_phy;
> +       uint8_t  secondary_phy;
> +       uint8_t  sid;
> +       uint8_t  tx_power;
> +       int8_t   rssi;
> +       uint16_t interval;
> +       uint8_t  direct_addr_type;
> +       uint8_t  direct_addr[6];
> +       uint8_t  data_len;
> +} __attribute__ ((packed));
> +
>  #define BT_HCI_EVT_LE_CHAN_SELECT_ALG          0x14
>  struct bt_hci_evt_le_chan_select_alg {
>         uint16_t handle;
> diff --git a/monitor/packet.c b/monitor/packet.c
> index dbb920f..5e4f081 100644
> --- a/monitor/packet.c
> +++ b/monitor/packet.c
> @@ -2304,7 +2304,7 @@ static void print_num_reports(uint8_t num_reports)
>         print_field("Num reports: %d", num_reports);
>  }
>
> -static void print_adv_event_type(uint8_t type)
> +static void print_adv_event_type(const char *label, uint8_t type)
>  {
>         const char *str;
>
> @@ -2329,7 +2329,7 @@ static void print_adv_event_type(uint8_t type)
>                 break;
>         }
>
> -       print_field("Event type: %s (0x%2.2x)", str, type);
> +       print_field("%s: %s (0x%2.2x)", label, str, type);
>  }
>
>  static void print_rssi(int8_t rssi)
> @@ -9417,7 +9417,7 @@ static void le_adv_report_evt(const void *data, uin=
t8_t size)
>         print_num_reports(evt->num_reports);
>
>  report:
> -       print_adv_event_type(evt->event_type);
> +       print_adv_event_type("Event type", evt->event_type);
>         print_peer_addr_type("Address type", evt->addr_type);
>         print_addr("Address", evt->addr, evt->addr_type);
>         print_field("Data length: %d", evt->data_len);
> @@ -9535,7 +9535,7 @@ static void le_direct_adv_report_evt(const void *da=
ta, uint8_t size)
>
>         print_num_reports(evt->num_reports);
>
> -       print_adv_event_type(evt->event_type);
> +       print_adv_event_type("Event type", evt->event_type);
>         print_peer_addr_type("Address type", evt->addr_type);
>         print_addr("Address", evt->addr, evt->addr_type);
>         print_addr_type("Direct address type", evt->direct_addr_type);
> @@ -9556,6 +9556,84 @@ static void le_phy_update_complete_evt(const void =
*data, uint8_t size)
>         print_le_phy("RX PHY", evt->rx_phy);
>  }
>
> +static void le_ext_adv_report_evt(const void *data, uint8_t size)
> +{
> +       const struct bt_hci_evt_le_ext_adv_report *evt =3D data;
> +       const struct bt_hci_le_ext_adv_report *report;
> +       const char *str;
> +       int i;
> +
> +       print_num_reports(evt->num_reports);
> +
> +       data +=3D sizeof(evt->num_reports);
> +
> +       for (i =3D 0; i < evt->num_reports; ++i) {
> +               report =3D data;
> +               print_field("Entry %d", i);
> +               print_adv_event_type("  Event type", report->event_type);
> +               print_peer_addr_type("  Address type", report->addr_type)=
;
> +               print_addr("  Address", report->addr, report->addr_type);
> +
> +               switch (report->primary_phy) {
> +               case 0x01:
> +                       str =3D "LE 1M";
> +                       break;
> +               case 0x03:
> +                       str =3D "LE Coded";
> +                       break;
> +               default:
> +                       str =3D "Reserved";
> +                       break;
> +               }
> +
> +               print_field("  Primary PHY: %s", str);
> +
> +               switch (report->secondary_phy) {
> +               case 0x00:
> +                       str =3D "No packets";
> +                       break;
> +               case 0x01:
> +                       str =3D "LE 1M";
> +                       break;
> +               case 0x02:
> +                       str =3D "LE 2M";
> +                       break;
> +               case 0x03:
> +                       str =3D "LE Coded";
> +                       break;
> +               default:
> +                       str =3D "Reserved";
> +                       break;
> +               }
> +
> +               print_field("  Secondary PHY: %s", str);
> +
> +               if (report->sid =3D=3D 0xff)
> +                       print_field("  SID: no ADI field (0x%2.2x)", repo=
rt->sid);
> +               else if (report->sid > 0x0f)
> +                       print_field("  SID: Reserved (0x%2.2x)", report->=
sid);
> +               else
> +                       print_field("  SID: 0x%2.2x", report->sid);
> +
> +               print_field("  TX power: %d dBm", report->tx_power);
> +
> +               if (report->rssi =3D=3D 127)
> +                       print_field("  RSSI: not available (0x%2.2x)", (u=
int8_t) report->rssi);
> +               else if (report->rssi >=3D -127 && report->rssi <=3D 20)
> +                       print_field("  RSSI: %d dBm (0x%2.2x)", report->r=
ssi, (uint8_t) report->rssi);
> +               else
> +                       print_field("  RSSI: reserved (0x%2.2x)", (uint8_=
t) report->rssi);
> +
> +               print_slot_125("  Periodic advertising invteral", report-=
>interval);
> +               print_peer_addr_type("  Direct address type", report->dir=
ect_addr_type);
> +               print_addr("  Direct address", report->direct_addr, repor=
t->direct_addr_type);
> +               print_field("  Data length: 0x%2.2x", report->data_len);
> +               data +=3D sizeof(struct bt_hci_le_ext_adv_report);
> +               packet_hexdump(data, report->data_len);
> +               data +=3D report->data_len;
> +       }
> +}
> +
>  static void le_chan_select_alg_evt(const void *data, uint8_t size)
>  {
>         const struct bt_hci_evt_le_chan_select_alg *evt =3D data;
> @@ -9646,7 +9724,8 @@ static const struct subevent_data le_meta_event_tab=
le[] =3D {
>                                 le_direct_adv_report_evt, 1, false },
>         { 0x0c, "LE PHY Update Complete",
>                                 le_phy_update_complete_evt, 5, true},
> -       { 0x0d, "LE Extended Advertising Report" },
> +       { 0x0d, "LE Extended Advertising Report",
> +                               le_ext_adv_report_evt, 1, false},
>         { 0x0e, "LE Periodic Advertising Sync Established" },
>         { 0x0f, "LE Periodic Advertising Report" },
>         { 0x10, "LE Periodic Advertising Sync Lost" },
> --
> 2.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth=
" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Best regads
=C5=81ukasz

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH BlueZ 1/2] monitor: Add LE Set Extended Scan Parameters decoding
  2017-06-06  9:40 ` [PATCH BlueZ 1/2] monitor: Add LE Set Extended Scan Parameters decoding Michał Narajowski
@ 2017-06-08  8:38   ` Marcel Holtmann
  0 siblings, 0 replies; 40+ messages in thread
From: Marcel Holtmann @ 2017-06-08  8:38 UTC (permalink / raw)
  To: Michał Narajowski; +Cc: linux-bluetooth

Hi Michal,

> ---
> monitor/bt.h     | 12 +++++++
> monitor/packet.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 109 insertions(+), 1 deletion(-)
> 
> diff --git a/monitor/bt.h b/monitor/bt.h
> index 660564a..5ec3e5e 100644
> --- a/monitor/bt.h
> +++ b/monitor/bt.h
> @@ -2272,6 +2272,18 @@ struct bt_hci_cmd_le_set_periodic_adv_enable {
> 	uint8_t  handle;
> } __attribute__ ((packed));
> 
> +#define BT_HCI_CMD_LE_SET_EXT_SCAN_PARAMS		0x2041
> +struct bt_hci_cmd_le_set_ext_scan_params {
> +	uint8_t  own_addr_type;
> +	uint8_t  filter_policy;
> +	uint8_t  phys;
> +} __attribute__ ((packed));
> +struct bt_hci_le_scan_phy {
> +	uint8_t  type;
> +	uint16_t  interval;
> +	uint16_t  window;

some of the indentation went wrong here.

> +} __attribute__ ((packed));
> +
> #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
> struct bt_hci_evt_inquiry_complete {
> 	uint8_t  status;
> diff --git a/monitor/packet.c b/monitor/packet.c
> index 8ffda90..fb6aee2 100644
> --- a/monitor/packet.c
> +++ b/monitor/packet.c
> @@ -7336,6 +7336,101 @@ static void le_set_periodic_adv_enable_cmd(const void *data, uint8_t size)
> 	print_handle(cmd->handle);
> }
> 
> +static const struct {
> +	uint8_t bit;
> +	const char *str;
> +} ext_scan_phys_table[] = {
> +	{  0, "LE 1M"		},
> +	{  2, "LE Coded"		},
> +	{ }
> +};
> +
> +static int print_ext_scan_phys(uint8_t flags)
> +{
> +	uint8_t mask = flags;
> +	int bits_set = 0;
> +	int i;
> +
> +	print_field("PHYs: 0x%2.2x", flags);
> +
> +	for (i = 0; ext_scan_phys_table[i].str; i++) {
> +		if (flags & (1 << ext_scan_phys_table[i].bit)) {
> +			print_field("  %s", ext_scan_phys_table[i].str);
> +			mask &= ~(1 << ext_scan_phys_table[i].bit);
> +			++bits_set;
> +		}
> +	}
> +
> +	if (mask)
> +		print_text(COLOR_UNKNOWN_ADV_FLAG, "  Unknown scanning PHYs"
> +							" (0x%2.2x)", mask);
> +	return bits_set;
> +}
> +
> +static void print_scan_filter_policy(uint8_t policy)
> +{
> +	const char *str;
> +
> +	switch (policy) {
> +	case 0x00:
> +		str = "Accept all advertisement";
> +		break;
> +	case 0x01:
> +		str = "Ignore not in white list";
> +		break;
> +	case 0x02:
> +		str = "Accept all advertisement, inc. directed unresolved RPA";
> +		break;
> +	case 0x03:
> +		str = "Ignore not in white list, exc. directed unresolved RPA";
> +		break;
> +	default:
> +		str = "Reserved";
> +		break;
> +	}
> +
> +	print_field("Filter policy: %s (0x%2.2x)", str, policy);
> +}
> +
> +static void print_scan_type(uint8_t type)
> +{
> +	const char *str;
> +
> +	switch (type) {
> +	case 0x00:
> +		str = "Passive";
> +		break;
> +	case 0x01:
> +		str = "Active";
> +		break;
> +	default:
> +		str = "Reserved";
> +		break;
> +	}
> +
> +	print_field("Type: %s (0x%2.2x)", str, type);
> +}

Then lets please use them also for the other the legacy commands.

Regards

Marcel


^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH BlueZ 04/31] monitor: Add LE Set Extended Advertising Parameters decoding
  2017-06-06  9:40 ` [PATCH BlueZ 04/31] monitor: Add LE Set Extended Advertising Parameters decoding Michał Narajowski
@ 2017-06-08  8:44   ` Marcel Holtmann
  2017-06-08 13:00   ` Szymon Janc
  1 sibling, 0 replies; 40+ messages in thread
From: Marcel Holtmann @ 2017-06-08  8:44 UTC (permalink / raw)
  To: Michał Narajowski; +Cc: linux-bluetooth

Hi Michal,

> < HCI Command: LE Set Extended Advertising Parameters (0x08|0x0036) plen 25
>        Handle: 0x01
>        Properties: 0x0000
>        Min advertising interval: 20.000 msec (0x0020)
>        Max advertising interval: 159.375 msec (0x00ff)
>        Channel map: 37, 38, 39 (0x07)
>        Own address type: Random (0x01)
>        Peer address type: Public (0x00)
>        Peer address: 00:00:00:00:00:00 (OUI 00-00-00)
>        Filter policy: Allow Scan Request from Any, Allow Connect Request from Any (0x00)
>        Tx power: 0xff
>        Primary PHY: LE 1M
>        Secondary max skip: 0x00
>        Secondary PHY: LE Coded (0x03)
>        SID: 0x06
>        Scan request notifications: Disabled
> ---
> monitor/bt.h     |  24 +++++++++
> monitor/packet.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 181 insertions(+), 1 deletion(-)
> 
> diff --git a/monitor/bt.h b/monitor/bt.h
> index d2e3e16..e903366 100644
> --- a/monitor/bt.h
> +++ b/monitor/bt.h
> @@ -2182,6 +2182,30 @@ struct bt_hci_cmd_le_set_adv_set_rand_addr {
> 	uint8_t  bdaddr[6];
> } __attribute__ ((packed));
> 
> +#define BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS			0x2036
> +struct bt_hci_cmd_le_set_ext_adv_params {
> +	uint8_t  handle;
> +	uint16_t evt_properties;
> +	uint8_t  min_interval[3];
> +	uint8_t  max_interval[3];
> +	uint8_t  channel_map;
> +	uint8_t  own_addr_type;
> +	uint8_t  peer_addr_type;
> +	uint8_t  peer_addr[6];
> +	uint8_t  filter_policy;
> +	uint8_t  tx_power;
> +	uint8_t  primary_phy;
> +	uint8_t  secondary_max_skip;
> +	uint8_t  secondary_phy;
> +	uint8_t  sid;
> +	uint8_t  notif_enable;
> +} __attribute__ ((packed));
> +struct bt_hci_rsp_le_set_ext_adv_params {
> +	uint8_t  status;
> +	uint8_t  tx_power;
> +} __attribute__ ((packed));
> +
> +
> #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
> struct bt_hci_evt_inquiry_complete {
> 	uint8_t  status;
> diff --git a/monitor/packet.c b/monitor/packet.c
> index 771b7bb..35ffde9 100644
> --- a/monitor/packet.c
> +++ b/monitor/packet.c
> @@ -6939,6 +6939,160 @@ static void le_set_adv_set_rand_addr(const void *data, uint8_t size)
> 	print_addr("Advertising random address", cmd->bdaddr, 0x00);
> }
> 
> +static const struct {
> +	uint8_t bit;
> +	const char *str;
> +} ext_adv_properties_table[] = {
> +	{  0, "Connectable"		},
> +	{  1, "Scannable"		},
> +	{  2, "Directed"	},
> +	{  3, "High Duty Cycle Directed Connectable"	},
> +	{  4, "Use legacy advertising PDUs"	},
> +	{  5, "Anonymous advertising"	},
> +	{  6, "Include TxPower"		},
> +	{ }
> +};
> +
> +static void print_ext_adv_properties(uint16_t flags)
> +{
> +	uint16_t mask = flags;
> +	int i;
> +
> +	print_field("Properties: 0x%4.4x", flags);
> +
> +	for (i = 0; ext_adv_properties_table[i].str; i++) {
> +		if (flags & (1 << ext_adv_properties_table[i].bit)) {
> +			print_field("  %s", ext_adv_properties_table[i].str);
> +			mask &= ~(1 << ext_adv_properties_table[i].bit);
> +		}
> +	}
> +
> +	if (mask)
> +		print_text(COLOR_UNKNOWN_ADV_FLAG, "  Unknown advertising properties"
> +							" (0x%4.4x)", mask);
> +}
> +
> +static void print_ext_slot_625(const char *label, const uint8_t value[3])
> +{
> +	uint32_t value_cpu = value[0];
> +
> +	value_cpu |= value[1] << 8;
> +	value_cpu |= value[2] << 16;
> +
> +	 print_field("%s: %.3f msec (0x%4.4x)", label,
> +				 value_cpu * 0.625, value_cpu);
> +}

and here is another formatting snafu.

> +
> +

And here again.

> +static void le_set_ext_adv_params_cmd(const void *data, uint8_t size)
> +{
> +	const struct bt_hci_cmd_le_set_ext_adv_params *cmd = data;
> +	const char *str;
> +
> +	print_field("Handle: 0x%2.2x", cmd->handle);
> +	print_ext_adv_properties(le16_to_cpu(cmd->evt_properties));
> +
> +	print_ext_slot_625("Min advertising interval", cmd->min_interval);
> +	print_ext_slot_625("Max advertising interval", cmd->max_interval);
> +
> +	switch (cmd->channel_map) {
> +	case 0x01:
> +		str = "37";
> +		break;
> +	case 0x02:
> +		str = "38";
> +		break;
> +	case 0x03:
> +		str = "37, 38";
> +		break;
> +	case 0x04:
> +		str = "39";
> +		break;
> +	case 0x05:
> +		str = "37, 39";
> +		break;
> +	case 0x06:
> +		str = "38, 39";
> +		break;
> +	case 0x07:
> +		str = "37, 38, 39";
> +		break;
> +	default:
> +		str = "Reserved";
> +		break;
> +	}
> +
> +	print_field("Channel map: %s (0x%2.2x)", str, cmd->channel_map);
> +
> +	print_own_addr_type(cmd->own_addr_type);
> +	print_peer_addr_type("Peer address type", cmd->peer_addr_type);
> +	print_addr("Peer address", cmd->peer_addr, cmd->peer_addr_type);
> +
> +	switch (cmd->filter_policy) {
> +	case 0x00:
> +		str = "Allow Scan Request from Any, "
> +			"Allow Connect Request from Any";
> +		break;
> +	case 0x01:
> +		str = "Allow Scan Request from White List Only, "
> +			"Allow Connect Request from Any";
> +		break;
> +	case 0x02:
> +		str = "Allow Scan Request from Any, "
> +			"Allow Connect Request from White List Only";
> +		break;
> +	case 0x03:
> +		str = "Allow Scan Request from White List Only, "
> +			"Allow Connect Request from White List Only";
> +		break;
> +	default:
> +		str = "Reserved";
> +		break;
> +	}
> +
> +	print_field("Filter policy: %s (0x%2.2x)", str, cmd->filter_policy);
> +	print_field("Tx power: 0x%2.2x", cmd->tx_power);
> +
> +	switch (cmd->primary_phy) {
> +	case 0x01:
> +		str = "LE 1M";
> +		break;
> +	case 0x03:
> +		str = "LE Coded";
> +		break;
> +	default:
> +		str = "Reserved";
> +		break;
> +	}
> +
> +	print_field("Primary PHY: %s", str);
> +	print_field("Secondary max skip: 0x%2.2x", cmd->secondary_max_skip);
> +	print_le_phy("Secondary PHY", cmd->secondary_phy);
> +	print_field("SID: 0x%2.2x", cmd->sid);
> +
> +

And here.

> +	switch (cmd->notif_enable) {
> +	case 0x00:
> +		str = "Disabled";
> +		break;
> +	case 0x01:
> +		str = "Enabled";
> +		break;
> +	default:
> +		str = "Reserved";
> +		break;
> +	}
> +	print_field("Scan request notifications: %s", str);
> +}
> +
> +static void le_set_ext_adv_params_rsp(const void *data, uint8_t size)
> +{
> +	const struct bt_hci_rsp_le_set_ext_adv_params *rsp = data;
> +
> +	print_status(rsp->status);
> +	print_field("Selected Tx power: 0x%2.2x", rsp->tx_power);
> +}
> +
> struct opcode_data {
> 	uint16_t opcode;
> 	int bit;
> @@ -7651,7 +7805,9 @@ static const struct opcode_data opcode_table[] = {
> 	{ 0x2035, 289, "LE Set Advertising Set Random Address",
> 				le_set_adv_set_rand_addr, 7, true,
> 				status_rsp, 1, true },
> -	{ 0x2036, 290, "LE Set Extended Advertising Parameters" },
> +	{ 0x2036, 290, "LE Set Extended Advertising Parameters",
> +				le_set_ext_adv_params_cmd, 25, true,
> +				le_set_ext_adv_params_rsp, 2, true },
> 	{ 0x2037, 291, "LE Set Extended Advertising Data" },
> 	{ 0x2038, 292, "LE Set Extended Scan Response Data" },
> 	{ 0x2039, 293, "LE Set Extended Advertising Enable" },

Regards

Marcel


^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support
  2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
                   ` (32 preceding siblings ...)
  2017-06-06  9:41 ` [PATCH BlueZ 31/31] monitor: Add LE Scan Request Received " Michał Narajowski
@ 2017-06-08  8:47 ` Marcel Holtmann
  33 siblings, 0 replies; 40+ messages in thread
From: Marcel Holtmann @ 2017-06-08  8:47 UTC (permalink / raw)
  To: Michał Narajowski; +Cc: linux-bluetooth

Hi Michal,

> this set adds support for decoding Bluetooth 5 commands as listed below.
> 
> Michał Narajowski (31):
>  monitor: Add LE Enhanced Receiver Test decoding
>  monitor: Add LE Enhanced Transmitter Test decoding

these two should be one patch.

>  monitor: Add LE Set Advertising Set Random Address decoding
>  monitor: Add LE Set Extended Advertising Parameters decoding
>  monitor: Add LE Set Extended Advertising Data decoding
>  monitor: Add LE Set Extended Scan Response Data decoding
>  monitor: Add LE Set Extended Advertising Enable decoding
>  monitor: Add LE Read Maximum Advertising Data Length decoding
>  monitor: Add LE Read Number of Supported Advertising Sets decoding
>  monitor: Add LE Remove Advertising Set decoding
>  monitor: Add LE Clear Advertising Sets decoding

Move these all into one patch.

>  monitor: Add LE Set Periodic Advertising Parameters decoding
>  monitor: Add LE Set Periodic Advertising Data decoding
>  monitor: Add LE Set Periodic Advertising Enable decoding

And make these 3 one patch.

>  monitor: Add LE Set Extended Scan Parameters decoding
>  monitor: Add LE Set Extended Scan Enable decoding
>  monitor: Add LE Extended Create Connection decoding

These 3 can also go into one patch.

>  monitor: Add LE Periodic Advertising Create Sync decoding
>  monitor: Add LE Periodic Advertising Create Sync Cancel decoding
>  monitor: Add LE Periodic Advertising Terminate Sync decoding
>  monitor: Add LE Add Device To Periodic Advertiser List decoding
>  monitor: Add LE Remove Device From Periodic Advertiser List decoding
>  monitor: Add LE Clear Periodic Advertiser List decoding
>  monitor: Add LE Read Periodic Advertiser List Size decoding

And these can go into one patch as well.

>  monitor: Add LE Read Transmit Power decoding
>  monitor: Add LE Read RF Path Compensation decoding
>  monitor: Add LE Write RF Path Compensation decoding

Put these 3 into one patch.

>  monitor: Add LE Set Privacy Mode decoding

Keep this separate.

>  monitor: Add LE Extended Advertising Report Event decoding
>  monitor: Add LE Advertising Set Terminated Event decoding
>  monitor: Add LE Scan Request Received Event decoding

And feed the events into the appropriate block. for their commands.

Regards

Marcel


^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH BlueZ 04/31] monitor: Add LE Set Extended Advertising Parameters decoding
  2017-06-06  9:40 ` [PATCH BlueZ 04/31] monitor: Add LE Set Extended Advertising Parameters decoding Michał Narajowski
  2017-06-08  8:44   ` Marcel Holtmann
@ 2017-06-08 13:00   ` Szymon Janc
  1 sibling, 0 replies; 40+ messages in thread
From: Szymon Janc @ 2017-06-08 13:00 UTC (permalink / raw)
  To: Michał Narajowski; +Cc: linux-bluetooth

Hi Micha=C5=82,

On Tuesday, 6 June 2017 11:40:53 CEST Micha=C5=82 Narajowski wrote:
> < HCI Command: LE Set Extended Advertising Parameters (0x08|0x0036) plen =
25
>         Handle: 0x01
>         Properties: 0x0000
>         Min advertising interval: 20.000 msec (0x0020)
>         Max advertising interval: 159.375 msec (0x00ff)
>         Channel map: 37, 38, 39 (0x07)
>         Own address type: Random (0x01)
>         Peer address type: Public (0x00)
>         Peer address: 00:00:00:00:00:00 (OUI 00-00-00)
>         Filter policy: Allow Scan Request from Any, Allow Connect Request
> from Any (0x00) Tx power: 0xff
>         Primary PHY: LE 1M
>         Secondary max skip: 0x00
>         Secondary PHY: LE Coded (0x03)
>         SID: 0x06
>         Scan request notifications: Disabled
> ---
>  monitor/bt.h     |  24 +++++++++
>  monitor/packet.c | 158
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed,
> 181 insertions(+), 1 deletion(-)
>=20
> diff --git a/monitor/bt.h b/monitor/bt.h
> index d2e3e16..e903366 100644
> --- a/monitor/bt.h
> +++ b/monitor/bt.h
> @@ -2182,6 +2182,30 @@ struct bt_hci_cmd_le_set_adv_set_rand_addr {
>  	uint8_t  bdaddr[6];
>  } __attribute__ ((packed));
>=20
> +#define BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS			0x2036
> +struct bt_hci_cmd_le_set_ext_adv_params {
> +	uint8_t  handle;
> +	uint16_t evt_properties;
> +	uint8_t  min_interval[3];
> +	uint8_t  max_interval[3];
> +	uint8_t  channel_map;
> +	uint8_t  own_addr_type;
> +	uint8_t  peer_addr_type;
> +	uint8_t  peer_addr[6];
> +	uint8_t  filter_policy;
> +	uint8_t  tx_power;
> +	uint8_t  primary_phy;
> +	uint8_t  secondary_max_skip;
> +	uint8_t  secondary_phy;
> +	uint8_t  sid;
> +	uint8_t  notif_enable;
> +} __attribute__ ((packed));
> +struct bt_hci_rsp_le_set_ext_adv_params {
> +	uint8_t  status;
> +	uint8_t  tx_power;
> +} __attribute__ ((packed));
> +
> +
>  #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
>  struct bt_hci_evt_inquiry_complete {
>  	uint8_t  status;
> diff --git a/monitor/packet.c b/monitor/packet.c
> index 771b7bb..35ffde9 100644
> --- a/monitor/packet.c
> +++ b/monitor/packet.c
> @@ -6939,6 +6939,160 @@ static void le_set_adv_set_rand_addr(const void
> *data, uint8_t size) print_addr("Advertising random address", cmd->bdaddr,
> 0x00);
>  }
>=20
> +static const struct {
> +	uint8_t bit;
> +	const char *str;
> +} ext_adv_properties_table[] =3D {
> +	{  0, "Connectable"		},
> +	{  1, "Scannable"		},
> +	{  2, "Directed"	},
> +	{  3, "High Duty Cycle Directed Connectable"	},
> +	{  4, "Use legacy advertising PDUs"	},
> +	{  5, "Anonymous advertising"	},
> +	{  6, "Include TxPower"		},
> +	{ }
> +};
> +
> +static void print_ext_adv_properties(uint16_t flags)
> +{
> +	uint16_t mask =3D flags;
> +	int i;
> +
> +	print_field("Properties: 0x%4.4x", flags);
> +
> +	for (i =3D 0; ext_adv_properties_table[i].str; i++) {
> +		if (flags & (1 << ext_adv_properties_table[i].bit)) {
> +			print_field("  %s", ext_adv_properties_table[i].str);
> +			mask &=3D ~(1 << ext_adv_properties_table[i].bit);
> +		}
> +	}

This should also decode legacy PDU if legacy flag is set.

> +
> +	if (mask)
> +		print_text(COLOR_UNKNOWN_ADV_FLAG, "  Unknown advertising properties"
> +							" (0x%4.4x)", mask);
> +}
> +
> +static void print_ext_slot_625(const char *label, const uint8_t value[3])
> +{
> +	uint32_t value_cpu =3D value[0];
> +
> +	value_cpu |=3D value[1] << 8;
> +	value_cpu |=3D value[2] << 16;
> +
> +	 print_field("%s: %.3f msec (0x%4.4x)", label,
> +				 value_cpu * 0.625, value_cpu);
> +}
> +
> +
> +static void le_set_ext_adv_params_cmd(const void *data, uint8_t size)
> +{
> +	const struct bt_hci_cmd_le_set_ext_adv_params *cmd =3D data;
> +	const char *str;
> +
> +	print_field("Handle: 0x%2.2x", cmd->handle);
> +	print_ext_adv_properties(le16_to_cpu(cmd->evt_properties));
> +
> +	print_ext_slot_625("Min advertising interval", cmd->min_interval);
> +	print_ext_slot_625("Max advertising interval", cmd->max_interval);
> +
> +	switch (cmd->channel_map) {
> +	case 0x01:
> +		str =3D "37";
> +		break;
> +	case 0x02:
> +		str =3D "38";
> +		break;
> +	case 0x03:
> +		str =3D "37, 38";
> +		break;
> +	case 0x04:
> +		str =3D "39";
> +		break;
> +	case 0x05:
> +		str =3D "37, 39";
> +		break;
> +	case 0x06:
> +		str =3D "38, 39";
> +		break;
> +	case 0x07:
> +		str =3D "37, 38, 39";
> +		break;
> +	default:
> +		str =3D "Reserved";
> +		break;
> +	}
> +
> +	print_field("Channel map: %s (0x%2.2x)", str, cmd->channel_map);
> +
> +	print_own_addr_type(cmd->own_addr_type);
> +	print_peer_addr_type("Peer address type", cmd->peer_addr_type);
> +	print_addr("Peer address", cmd->peer_addr, cmd->peer_addr_type);
> +
> +	switch (cmd->filter_policy) {
> +	case 0x00:
> +		str =3D "Allow Scan Request from Any, "
> +			"Allow Connect Request from Any";
> +		break;
> +	case 0x01:
> +		str =3D "Allow Scan Request from White List Only, "
> +			"Allow Connect Request from Any";
> +		break;
> +	case 0x02:
> +		str =3D "Allow Scan Request from Any, "
> +			"Allow Connect Request from White List Only";
> +		break;
> +	case 0x03:
> +		str =3D "Allow Scan Request from White List Only, "
> +			"Allow Connect Request from White List Only";
> +		break;
> +	default:
> +		str =3D "Reserved";
> +		break;
> +	}
> +
> +	print_field("Filter policy: %s (0x%2.2x)", str, cmd->filter_policy);
> +	print_field("Tx power: 0x%2.2x", cmd->tx_power);
> +
> +	switch (cmd->primary_phy) {
> +	case 0x01:
> +		str =3D "LE 1M";
> +		break;
> +	case 0x03:
> +		str =3D "LE Coded";
> +		break;
> +	default:
> +		str =3D "Reserved";
> +		break;
> +	}
> +
> +	print_field("Primary PHY: %s", str);
> +	print_field("Secondary max skip: 0x%2.2x", cmd->secondary_max_skip);
> +	print_le_phy("Secondary PHY", cmd->secondary_phy);
> +	print_field("SID: 0x%2.2x", cmd->sid);
> +
> +
> +	switch (cmd->notif_enable) {
> +	case 0x00:
> +		str =3D "Disabled";
> +		break;
> +	case 0x01:
> +		str =3D "Enabled";
> +		break;
> +	default:
> +		str =3D "Reserved";
> +		break;
> +	}
> +	print_field("Scan request notifications: %s", str);
> +}
> +
> +static void le_set_ext_adv_params_rsp(const void *data, uint8_t size)
> +{
> +	const struct bt_hci_rsp_le_set_ext_adv_params *rsp =3D data;
> +
> +	print_status(rsp->status);
> +	print_field("Selected Tx power: 0x%2.2x", rsp->tx_power);
> +}
> +
>  struct opcode_data {
>  	uint16_t opcode;
>  	int bit;
> @@ -7651,7 +7805,9 @@ static const struct opcode_data opcode_table[] =3D {
>  	{ 0x2035, 289, "LE Set Advertising Set Random Address",
>  				le_set_adv_set_rand_addr, 7, true,
>  				status_rsp, 1, true },
> -	{ 0x2036, 290, "LE Set Extended Advertising Parameters" },
> +	{ 0x2036, 290, "LE Set Extended Advertising Parameters",
> +				le_set_ext_adv_params_cmd, 25, true,
> +				le_set_ext_adv_params_rsp, 2, true },
>  	{ 0x2037, 291, "LE Set Extended Advertising Data" },
>  	{ 0x2038, 292, "LE Set Extended Scan Response Data" },
>  	{ 0x2039, 293, "LE Set Extended Advertising Enable" },


=2D-=20
pozdrawiam
Szymon Janc

^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2017-06-08 13:00 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 01/31] monitor: Add LE Enhanced Receiver Test decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 1/2] monitor: Add LE Set Extended Scan Parameters decoding Michał Narajowski
2017-06-08  8:38   ` Marcel Holtmann
2017-06-06  9:40 ` [PATCH BlueZ 02/31] monitor: Add LE Enhanced Transmitter Test decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 2/2] monitor: Add LE Set Extended Scan Enable decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 03/31] monitor: Add LE Set Advertising Set Random Address decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 04/31] monitor: Add LE Set Extended Advertising Parameters decoding Michał Narajowski
2017-06-08  8:44   ` Marcel Holtmann
2017-06-08 13:00   ` Szymon Janc
2017-06-06  9:40 ` [PATCH BlueZ 05/31] monitor: Add LE Set Extended Advertising Data decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 06/31] monitor: Add LE Set Extended Scan Response " Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 07/31] monitor: Add LE Set Extended Advertising Enable decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 08/31] monitor: Add LE Read Maximum Advertising Data Length decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 09/31] monitor: Add LE Read Number of Supported Advertising Sets decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 10/31] monitor: Add LE Remove Advertising Set decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 11/31] monitor: Add LE Clear Advertising Sets decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 12/31] monitor: Add LE Set Periodic Advertising Parameters decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 13/31] monitor: Add LE Set Periodic Advertising Data decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 14/31] monitor: Add LE Set Periodic Advertising Enable decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 15/31] monitor: Add LE Set Extended Scan Parameters decoding Michał Narajowski
2017-06-06  9:46   ` Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 16/31] monitor: Add LE Set Extended Scan Enable decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 17/31] monitor: Add LE Extended Create Connection decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 18/31] monitor: Add LE Periodic Advertising Create Sync decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 19/31] monitor: Add LE Periodic Advertising Create Sync Cancel decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 20/31] monitor: Add LE Periodic Advertising Terminate Sync decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 21/31] monitor: Add LE Add Device To Periodic Advertiser List decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 22/31] monitor: Add LE Remove Device From " Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 23/31] monitor: Add LE Clear " Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 24/31] monitor: Add LE Read Periodic Advertiser List Size decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 25/31] monitor: Add LE Read Transmit Power decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 26/31] monitor: Add LE Read RF Path Compensation decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 27/31] monitor: Add LE Write " Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 28/31] monitor: Add LE Set Privacy Mode decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 29/31] monitor: Add LE Extended Advertising Report Event decoding Michał Narajowski
2017-06-06 14:10   ` Łukasz Rymanowski
2017-06-06  9:41 ` [PATCH BlueZ 30/31] monitor: Add LE Advertising Set Terminated " Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 31/31] monitor: Add LE Scan Request Received " Michał Narajowski
2017-06-08  8:47 ` [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox