linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/8] monitor: Update periodic sync commands.
@ 2020-01-07  9:18 Szymon Czapracki
  2020-01-07  9:18 ` [PATCH 2/8] monitor: Decode LE Periodic Advertising Sync Transfer Received Event Szymon Czapracki
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Szymon Czapracki @ 2020-01-07  9:18 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Czapracki

Change fields in periodic_adv_(create/term)_sync_cmd, according to their
description with 5.1 specification.

< HCI Command: LE Periodic Advertising Create Sync (0x08|0x0044) plen 14
        Options: 0x0001
        Use Periodic Advertiser List
        Reporting initially enabled
        SID: 0x00
        Adv address type: Public (0x00)
        Adv address: 00:00:00:00:00:00 (OUI 00-00-00)
        Skip: 0x0000
        Sync timeout: 0 msec (0x0000)
        Sync CTE type: 0x0000
> HCI Event: Command Status (0x0f) plen 4
      LE Periodic Advertising Create Sync (0x08|0x0044) ncmd 1
        Status: Unknown HCI Command (0x01)

Change-Id: Ic729dd3a6cb9bc02b7af6f78b9cf99909f6be154
---
 monitor/bt.h     |  6 +--
 monitor/packet.c | 96 ++++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 83 insertions(+), 19 deletions(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index 8edc895e8..ecf3782c9 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2371,13 +2371,13 @@ struct bt_hci_le_ext_create_conn {
 
 #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  options;
 	uint8_t  sid;
 	uint8_t  addr_type;
 	uint8_t  addr[6];
 	uint16_t skip;
 	uint16_t sync_timeout;
-	uint8_t  unused;
+	uint8_t  sync_cte_type;
 } __attribute__ ((packed));
 
 #define BT_HCI_CMD_LE_PERIODIC_ADV_CREATE_SYNC_CANCEL		0x2045
@@ -3108,7 +3108,7 @@ struct bt_hci_le_per_adv_report {
 	uint16_t handle;
 	uint8_t  tx_power;
 	int8_t   rssi;
-	uint8_t  unused;
+	uint8_t  cte_type;
 	uint8_t  data_status;
 	uint8_t  data_len;
 	uint8_t  data[0];
diff --git a/monitor/packet.c b/monitor/packet.c
index ab8bbdee5..64f75cf8e 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7321,24 +7321,70 @@ static void le_ext_create_conn_cmd(const void *data, uint8_t size)
 	print_ext_conn_phys(cmd->data, cmd->phys);
 }
 
-static void le_periodic_adv_create_sync_cmd(const void *data, uint8_t size)
+static const struct bitfield_data create_sync_cte_type[] = {
+	{  0, "Do not sync to packets with AoA CTE"	},
+	{  1, "Do not sync to packets with AoD CTE 1us"	},
+	{  2, "Do not sync to packets with AoD CTE 2us"	},
+	{  3, "Do not sync to packets with type 3 AoD"	},
+	{  4, "Do not sync to packets without CTE"	},
+	{ },
+};
+
+static const struct bitfield_data create_sync_options[] = {
+	{  0, "Use Periodic Advertiser List"	},
+	{  1, "Reporting initially disabled"	},
+	{ },
+};
+
+static const struct bitfield_data create_sync_options_alt[] = {
+	{  0, "Use advertising SID, Advertiser Address Type and address"},
+	{  1, "Reporting initially enabled"				},
+	{ },
+};
+
+static void print_create_sync_cte_type(uint8_t flags)
 {
-	const struct bt_hci_cmd_le_periodic_adv_create_sync *cmd = data;
-	const char *str;
+	uint8_t mask = flags;
 
-	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("Sync CTE type: 0x%4.4x", flags);
+
+	mask = print_bitfield(2, flags, create_sync_cte_type);
+
+	if (mask) {
+		print_text(COLOR_UNKNOWN_ADV_FLAG,
+				"Unknown sync CTE type properties (0x%4.4x)",
+									mask);
 	}
+}
 
-	print_field("Filter policy: %s (0x%2.2x)", str, cmd->filter_policy);
+static void print_create_sync_options(uint8_t flags)
+{
+	uint8_t mask = flags;
+	int i;
+
+	print_field("Options: 0x%4.4x", flags);
+
+	for (i = 0; create_sync_options[i].str; i++) {
+		if (flags & (1 << create_sync_options[i].bit)) {
+			print_field("%s", create_sync_options[i].str);
+			mask  &= ~(1 << create_sync_options[i].bit);
+		} else {
+			print_field("%s", create_sync_options_alt[i].str);
+			mask  &= ~(1 << create_sync_options_alt[i].bit);
+		}
+	}
+
+	if (mask) {
+		print_text(COLOR_UNKNOWN_ADV_FLAG,
+					"  Unknown options (0x%4.4x)", mask);
+	}
+}
+
+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;
+
+	print_create_sync_options(cmd->options);
 	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);
@@ -7346,7 +7392,7 @@ static void le_periodic_adv_create_sync_cmd(const void *data, uint8_t size)
 	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);
+	print_create_sync_cte_type(cmd->sync_cte_type);
 }
 
 static void le_periodic_adv_term_sync_cmd(const void *data, uint8_t size)
@@ -9648,7 +9694,25 @@ static void le_per_adv_report_evt(const void *data, uint8_t size)
 	else
 		print_field("RSSI: reserved (0x%2.2x)",
 						(uint8_t) evt->rssi);
-	print_field("Unused: (0x%2.2x)", evt->unused);
+
+	switch (evt->cte_type) {
+	case 0x00:
+		str = "AoA Constant Tone Extension";
+		break;
+	case 0x01:
+		str = "AoA Constant Tone Extension with 1us slots";
+		break;
+	case 0x02:
+		str = "AoD Constant Tone Extension with 2us slots";
+		break;
+	case 0xff:
+		str = "No Constant Tone Extension";
+		break;
+	default:
+		str = "Reserved";
+		color_on = COLOR_RED;
+		break;
+	}
 
 	switch (evt->data_status) {
 	case 0x00:
-- 
2.24.1


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

* [PATCH 2/8] monitor: Decode LE Periodic Advertising Sync Transfer Received Event
  2020-01-07  9:18 [PATCH 1/8] monitor: Update periodic sync commands Szymon Czapracki
@ 2020-01-07  9:18 ` Szymon Czapracki
  2020-01-07 23:43   ` Luiz Augusto von Dentz
  2020-01-07  9:18 ` [PATCH 3/8] monitor: Decode LE Set Periodic Advertising Receive Enable command Szymon Czapracki
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Szymon Czapracki @ 2020-01-07  9:18 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Czapracki

Change-Id: I5a7c2d36ca5aee61441c2aab6adeb16058ab062f
---
 monitor/bt.h     | 14 ++++++++++++++
 monitor/packet.c | 27 +++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/monitor/bt.h b/monitor/bt.h
index ecf3782c9..e14c1771f 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -3140,6 +3140,20 @@ struct bt_hci_evt_le_chan_select_alg {
 	uint8_t  algorithm;
 } __attribute__ ((packed));
 
+#define BT_HCI_EVT_LE_PER_ADV_SYNC_TRANS_REC		0x18
+struct bt_hci_evt_le_per_adv_sync_trans_rec {
+	uint8_t  status;
+	uint16_t handle;
+	uint16_t service_data;
+	uint16_t sync_handle;
+	uint8_t  sid;
+	uint8_t  addr_type;
+	uint8_t  addr[6];
+	uint8_t  phy;
+	uint16_t interval;
+	uint8_t  clock_accuracy;
+} __attribute__ ((packed));
+
 #define BT_HCI_ERR_SUCCESS			0x00
 #define BT_HCI_ERR_UNKNOWN_COMMAND		0x01
 #define BT_HCI_ERR_UNKNOWN_CONN_ID		0x02
diff --git a/monitor/packet.c b/monitor/packet.c
index 64f75cf8e..76bb9f239 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -600,6 +600,12 @@ static void print_addr_type(const char *label, uint8_t addr_type)
 	case 0x01:
 		str = "Random";
 		break;
+	case 0x02:
+		str = "Public Identity Address";
+		break;
+	case 0x03:
+		str = "Random Identity Address";
+		break;
 	default:
 		str = "Reserved";
 		break;
@@ -9788,6 +9794,24 @@ static void le_chan_select_alg_evt(const void *data, uint8_t size)
 	print_field("Algorithm: %s (0x%2.2x)", str, evt->algorithm);
 }
 
+static void le_per_adv_sync_trans_rec_evt(const void *data, uint8_t size)
+{
+	const struct bt_hci_evt_le_per_adv_sync_trans_rec *evt = data;
+
+	print_status(evt->status);
+	print_field("Handle: %d", evt->handle);
+	print_field("Connection handle: %d", evt->handle);
+	print_field("Service data: 0x%4.4x", evt->service_data);
+	print_field("Sync handle: %d", evt->sync_handle);
+	print_field("SID: 0x%2.2x", evt->sid);
+	print_addr_type("Address type:", evt->addr_type);
+	print_addr("Addres:", evt->addr, evt->addr_type);
+	print_le_phy("PHY:", evt->phy);
+	print_field("Periodic advertising Interval: %.3f",
+							1.25 * evt->interval);
+	print_clock_accuracy(evt->clock_accuracy);
+}
+
 struct subevent_data {
 	uint8_t subevent;
 	const char *str;
@@ -9871,6 +9895,9 @@ static const struct subevent_data le_meta_event_table[] = {
 				le_scan_req_received_evt, 8, true},
 	{ 0x14, "LE Channel Selection Algorithm",
 				le_chan_select_alg_evt, 3, true},
+	{ 0x18, "LE Periodic Advertising Sync Transfer Received",
+					le_per_adv_sync_trans_rec_evt, 19,
+					true},
 	{ }
 };
 
-- 
2.24.1


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

* [PATCH 3/8] monitor: Decode LE Set Periodic Advertising Receive Enable command
  2020-01-07  9:18 [PATCH 1/8] monitor: Update periodic sync commands Szymon Czapracki
  2020-01-07  9:18 ` [PATCH 2/8] monitor: Decode LE Periodic Advertising Sync Transfer Received Event Szymon Czapracki
@ 2020-01-07  9:18 ` Szymon Czapracki
  2020-01-07  9:18 ` [PATCH 4/8] monitor: Decode LE Periodic Advertising Sync Transfer command Szymon Czapracki
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Szymon Czapracki @ 2020-01-07  9:18 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Czapracki

< HCI Command: LE Periodic Advertising Receive Enable (0x08|0x0059) plen 3
        Sync handle: 0
        Reporting: Enabled (0x01)
> HCI Event: Command Status (0x0f) plen 4
      LE Periodic Advertising Receive Enable (0x08|0x0059) ncmd 1
        Status: Unknown HCI Command (0x01)

Change-Id: I19d3bfb7034992a14273b742b38f2c6cc6bd6deb
---
 monitor/bt.h     |  6 ++++++
 monitor/packet.c | 11 +++++++++++
 2 files changed, 17 insertions(+)

diff --git a/monitor/bt.h b/monitor/bt.h
index e14c1771f..bb373b528 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2461,6 +2461,12 @@ struct bt_hci_cmd_le_tx_test_v3 {
 	uint8_t  antenna_ids[0];
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_SET_PERIODIC_ADV_REC_ENABLE	0x2059
+struct bt_hci_cmd_set_periodic_adv_rec_enable {
+	uint16_t sync_handle;
+	uint8_t  enable;
+} __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 76bb9f239..c1e449a68 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7590,6 +7590,14 @@ static void le_tx_test_cmd_v3(const void *data, uint8_t size)
 		print_field("  Antenna ID: %u", cmd->antenna_ids[i]);
 }
 
+static void le_periodic_adv_rec_enable(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_set_periodic_adv_enable *cmd = data;
+
+	print_field("Sync handle: %d", cmd->handle);
+	print_enable("Reporting", cmd->enable);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8383,6 +8391,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2050, 316, "LE Transmitter Test command [v3]",
 				le_tx_test_cmd_v3, 9, false,
 				status_rsp, 1, true },
+	{ 0x2059, 325, "LE Periodic Advertising Receive Enable",
+				le_periodic_adv_rec_enable, 3, true,
+				status_rsp, 1, true },
 	{ }
 };
 
-- 
2.24.1


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

* [PATCH 4/8] monitor: Decode LE Periodic Advertising Sync Transfer command
  2020-01-07  9:18 [PATCH 1/8] monitor: Update periodic sync commands Szymon Czapracki
  2020-01-07  9:18 ` [PATCH 2/8] monitor: Decode LE Periodic Advertising Sync Transfer Received Event Szymon Czapracki
  2020-01-07  9:18 ` [PATCH 3/8] monitor: Decode LE Set Periodic Advertising Receive Enable command Szymon Czapracki
@ 2020-01-07  9:18 ` Szymon Czapracki
  2020-01-07 23:47   ` Luiz Augusto von Dentz
  2020-01-07  9:18 ` [PATCH 5/8] monitor: Decode LE Periodic Advertising Set Info " Szymon Czapracki
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Szymon Czapracki @ 2020-01-07  9:18 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Czapracki

< HCI Command: LE Periodic Advertising Sync Transfer (0x08|0x005a) plen 6
        Connection handle: 1
        Service data: 0x0001
        Sync handle: 1
> HCI Event: Command Status (0x0f) plen 4
      LE Periodic Advertising Sync Transfer (0x08|0x005a) ncmd 1
        Status: Unknown HCI Command (0x01)

Change-Id: I9009c6c2299cc5e56bb94ddd46e8accbacbcc800
---
 monitor/bt.h     |  7 +++++++
 monitor/packet.c | 19 +++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/monitor/bt.h b/monitor/bt.h
index bb373b528..efaf80f55 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2467,6 +2467,13 @@ struct bt_hci_cmd_set_periodic_adv_rec_enable {
 	uint8_t  enable;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_PERIODIC_SYNC_TRANS	0x205a
+struct bt_hci_cmd_periodic_sync_trans {
+	uint16_t handle;
+	uint16_t service_data;
+	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 c1e449a68..06fd72537 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -4025,6 +4025,13 @@ static void status_rsp(const void *data, uint8_t size)
 	print_status(status);
 }
 
+static void status_handle_rsp(const void *data, uint8_t size)
+{
+	uint8_t status = *((const uint8_t *) data);
+	print_status(status);
+	print_field("Connection handle: %d", get_u8(data + 1));
+}
+
 static void status_bdaddr_rsp(const void *data, uint8_t size)
 {
 	uint8_t status = *((const uint8_t *) data);
@@ -7598,6 +7605,15 @@ static void le_periodic_adv_rec_enable(const void *data, uint8_t size)
 	print_enable("Reporting", cmd->enable);
 }
 
+static void le_periodic_adv_sync_trans(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_periodic_sync_trans *cmd = data;
+
+	print_field("Connection handle: %d", cmd->handle);
+	print_field("Service data: 0x%4.4x", cmd->service_data);
+	print_field("Sync handle: %d", cmd->sync_handle);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8394,6 +8410,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2059, 325, "LE Periodic Advertising Receive Enable",
 				le_periodic_adv_rec_enable, 3, true,
 				status_rsp, 1, true },
+	{ 0x205a, 326, "LE Periodic Advertising Sync Transfer",
+				le_periodic_adv_sync_trans, 6, true,
+				status_handle_rsp, 3, true },
 	{ }
 };
 
-- 
2.24.1


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

* [PATCH 5/8] monitor: Decode LE Periodic Advertising Set Info Transfer command
  2020-01-07  9:18 [PATCH 1/8] monitor: Update periodic sync commands Szymon Czapracki
                   ` (2 preceding siblings ...)
  2020-01-07  9:18 ` [PATCH 4/8] monitor: Decode LE Periodic Advertising Sync Transfer command Szymon Czapracki
@ 2020-01-07  9:18 ` Szymon Czapracki
  2020-01-07 23:48   ` Luiz Augusto von Dentz
  2020-01-07  9:18 ` [PATCH 6/8] monitor: Decode LE Set Periodic Adv Sync Transfer Parameterers command Szymon Czapracki
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Szymon Czapracki @ 2020-01-07  9:18 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Czapracki

< HCI Command: LE Periodic Advertising Set Info Transfer (0x08|0x005b) plen 5
       Connection handle: 1
       Service data: 0x0000
       Advertising handle: 0
> HCI Event: Command Status (0x0f) plen 4
     LE Periodic Advertising Set Info Transfer (0x08|0x005b) ncmd 1
       Status: Unknown HCI Command (0x01)

Change-Id: I4167e85f29e20304d1b72ec537ece70a68e8407e
---
 monitor/bt.h     |  7 +++++++
 monitor/packet.c | 12 ++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/monitor/bt.h b/monitor/bt.h
index efaf80f55..f8422ccc9 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2474,6 +2474,13 @@ struct bt_hci_cmd_periodic_sync_trans {
 	uint16_t sync_handle;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_PERIODIC_ADV_SET_INFO_TRANS	0x205b
+struct bt_hci_cmd_periodic_adv_set_info_trans {
+	uint16_t handle;
+	uint16_t service_data;
+	uint16_t adv_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 06fd72537..3c3399c0c 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7614,6 +7614,15 @@ static void le_periodic_adv_sync_trans(const void *data, uint8_t size)
 	print_field("Sync handle: %d", cmd->sync_handle);
 }
 
+static void le_periodic_adv_set_info_trans(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_periodic_adv_set_info_trans *cmd = data;
+
+	print_field("Connection handle: %d", cmd->handle);
+	print_field("Service data: 0x%4.4x", cmd->service_data);
+	print_field("Advertising handle: %d", cmd->adv_handle);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8413,6 +8422,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x205a, 326, "LE Periodic Advertising Sync Transfer",
 				le_periodic_adv_sync_trans, 6, true,
 				status_handle_rsp, 3, true },
+	{ 0x205b, 327, "LE Periodic Advertising Set Info Transfer",
+				le_periodic_adv_set_info_trans, 5, true,
+				status_handle_rsp, 3, true },
 	{ }
 };
 
-- 
2.24.1


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

* [PATCH 6/8] monitor: Decode LE Set Periodic Adv Sync Transfer Parameterers command
  2020-01-07  9:18 [PATCH 1/8] monitor: Update periodic sync commands Szymon Czapracki
                   ` (3 preceding siblings ...)
  2020-01-07  9:18 ` [PATCH 5/8] monitor: Decode LE Periodic Advertising Set Info " Szymon Czapracki
@ 2020-01-07  9:18 ` Szymon Czapracki
  2020-01-07  9:18 ` [PATCH 7/8] monitor: Decode LE Set Default Periodic Adv Sync Transfer Params. command Szymon Czapracki
  2020-01-07  9:18 ` [PATCH 8/8] monitor: Decode LE CTE Request Failed event Szymon Czapracki
  6 siblings, 0 replies; 13+ messages in thread
From: Szymon Czapracki @ 2020-01-07  9:18 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Czapracki

< HCI Command: LE Periodic Advertising Sync Transfer Parameters (0x08|0x005c) plen 8
        Connection handle: 1
        Mode: Disabled (0x00)
        Skip: 0x00
        Sync timeout: 0 msec (0x0000)
        Sync CTE type: 0x0000
> HCI Event: Command Status (0x0f) plen 4
      LE Periodic Advertising Sync Transfer Parameters (0x08|0x005c) ncmd 1
        Status: Unknown HCI Command (0x01)

Change-Id: I5cd115eaa4bf411f5f4cd3899ac516b71fcfdd10
---
 monitor/bt.h     |  9 +++++++++
 monitor/packet.c | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/monitor/bt.h b/monitor/bt.h
index f8422ccc9..2ec2ea0a7 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2481,6 +2481,15 @@ struct bt_hci_cmd_periodic_adv_set_info_trans {
 	uint16_t adv_handle;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_PERIODIC_ADV_SYNC_TRANS_PARAMS	0x205c
+struct bt_hci_cmd_periodic_adv_sync_trans_params {
+	uint16_t  handle;
+	uint8_t   mode;
+	uint16_t  skip;
+	uint16_t  sync_timeout;
+	uint8_t   cte_type;
+} __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 3c3399c0c..4a8404a02 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7623,6 +7623,41 @@ static void le_periodic_adv_set_info_trans(const void *data, uint8_t size)
 	print_field("Advertising handle: %d", cmd->adv_handle);
 }
 
+static void print_sync_mode(uint8_t mode) {
+
+	const char *str;
+
+	switch(mode) {
+	case 0x00:
+		str = "Disabled";
+		break;
+	case 0x01:
+		str = "Enabled with report events disabled";
+		break;
+	case 0x02:
+		str = "Enabled with report events enabled";
+		break;
+	default:
+		str = "RFU";
+		break;
+	}
+
+	print_field("Mode: %s (0x%2.2x)", str, mode);
+}
+
+static void le_periodic_adv_sync_trans_params(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_periodic_adv_sync_trans_params *cmd = data;
+
+	print_field("Connection handle: %d", cmd->handle);
+	print_sync_mode(cmd->mode);
+	print_field("Skip: 0x%2.2x", 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_create_sync_cte_type(cmd->cte_type);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8425,6 +8460,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x205b, 327, "LE Periodic Advertising Set Info Transfer",
 				le_periodic_adv_set_info_trans, 5, true,
 				status_handle_rsp, 3, true },
+	{ 0x205c, 328, "LE Periodic Advertising Sync Transfer Parameters",
+				le_periodic_adv_sync_trans_params, 8, true,
+				status_handle_rsp, 3, true},
 	{ }
 };
 
-- 
2.24.1


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

* [PATCH 7/8] monitor: Decode LE Set Default Periodic Adv Sync Transfer Params. command
  2020-01-07  9:18 [PATCH 1/8] monitor: Update periodic sync commands Szymon Czapracki
                   ` (4 preceding siblings ...)
  2020-01-07  9:18 ` [PATCH 6/8] monitor: Decode LE Set Periodic Adv Sync Transfer Parameterers command Szymon Czapracki
@ 2020-01-07  9:18 ` Szymon Czapracki
  2020-01-07  9:18 ` [PATCH 8/8] monitor: Decode LE CTE Request Failed event Szymon Czapracki
  6 siblings, 0 replies; 13+ messages in thread
From: Szymon Czapracki @ 2020-01-07  9:18 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Czapracki

< HCI Command: LE Set Default Periodic Advertisng Sync Transfer Parameters (0x08|0x005d) plen 6
        Mode: Enabled with report events disabled (0x01)
        Skip: 0x00
        Sync timeout: 0 msec (0x0000)
        Sync CTE type: 0x0000
> HCI Event: Command Status (0x0f) plen 4
      LE Set Default Periodic Advertisng Sync Transfer Parameters (0x08|0x005d) ncmd 1
        Status: Unknown HCI Command (0x01)

Change-Id: Ia88ddc33a59724f5e32624942759b3ef4d6b70aa
---
 monitor/bt.h     |  8 ++++++++
 monitor/packet.c | 17 +++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/monitor/bt.h b/monitor/bt.h
index 2ec2ea0a7..1859dfb21 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2490,6 +2490,14 @@ struct bt_hci_cmd_periodic_adv_sync_trans_params {
 	uint8_t   cte_type;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_DEFAULT_PERIODIC_ADV_SYNC_TRANS_PARAMS	0x205d
+struct bt_hci_cmd_default_periodic_adv_sync_trans_params {
+	uint8_t  mode;
+	uint16_t skip;
+	uint16_t sync_timeout;
+	uint8_t  cte_type;
+} __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 4a8404a02..d34533966 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7658,6 +7658,19 @@ static void le_periodic_adv_sync_trans_params(const void *data, uint8_t size)
 	print_create_sync_cte_type(cmd->cte_type);
 }
 
+static void le_set_default_periodic_adv_sync_trans_params(const void *data,
+								uint8_t size)
+{
+	const struct bt_hci_cmd_default_periodic_adv_sync_trans_params *cmd = data;
+
+	print_sync_mode(cmd->mode);
+	print_field("Skip: 0x%2.2x", 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_create_sync_cte_type(cmd->cte_type);
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -8463,6 +8476,10 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x205c, 328, "LE Periodic Advertising Sync Transfer Parameters",
 				le_periodic_adv_sync_trans_params, 8, true,
 				status_handle_rsp, 3, true},
+	{ 0x205d, 329, "LE Set Default Periodic Advertisng Sync Transfer "
+				"Parameters",
+				le_set_default_periodic_adv_sync_trans_params,
+				6, true, status_rsp, 1, true},
 	{ }
 };
 
-- 
2.24.1


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

* [PATCH 8/8] monitor: Decode LE CTE Request Failed event
  2020-01-07  9:18 [PATCH 1/8] monitor: Update periodic sync commands Szymon Czapracki
                   ` (5 preceding siblings ...)
  2020-01-07  9:18 ` [PATCH 7/8] monitor: Decode LE Set Default Periodic Adv Sync Transfer Params. command Szymon Czapracki
@ 2020-01-07  9:18 ` Szymon Czapracki
  6 siblings, 0 replies; 13+ messages in thread
From: Szymon Czapracki @ 2020-01-07  9:18 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Czapracki

Change-Id: I71f84663461e5d0a3403ab43d33d276bc302acbc
---
 monitor/bt.h     |  6 ++++++
 monitor/packet.c | 10 ++++++++++
 2 files changed, 16 insertions(+)

diff --git a/monitor/bt.h b/monitor/bt.h
index 1859dfb21..b31e6c5c5 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -3177,6 +3177,12 @@ struct bt_hci_evt_le_chan_select_alg {
 	uint8_t  algorithm;
 } __attribute__ ((packed));
 
+#define BT_HCI_EVT_LE_CTE_REQUEST_FAILED	0x17
+struct bt_hci_evt_le_cte_request_failed {
+	uint8_t  status;
+	uint16_t handle;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_LE_PER_ADV_SYNC_TRANS_REC		0x18
 struct bt_hci_evt_le_per_adv_sync_trans_rec {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index d34533966..3450373b0 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -9891,6 +9891,14 @@ static void le_chan_select_alg_evt(const void *data, uint8_t size)
 	print_field("Algorithm: %s (0x%2.2x)", str, evt->algorithm);
 }
 
+static void le_cte_request_failed_evt(const void *data, uint8_t size)
+{
+	const struct bt_hci_evt_le_cte_request_failed *evt = data;
+
+	print_status(evt->status);
+	print_field("Connection handle: %d", evt->handle);
+}
+
 static void le_per_adv_sync_trans_rec_evt(const void *data, uint8_t size)
 {
 	const struct bt_hci_evt_le_per_adv_sync_trans_rec *evt = data;
@@ -9992,6 +10000,8 @@ static const struct subevent_data le_meta_event_table[] = {
 				le_scan_req_received_evt, 8, true},
 	{ 0x14, "LE Channel Selection Algorithm",
 				le_chan_select_alg_evt, 3, true},
+	{ 0x17, "LE CTE Request Failed",
+				le_cte_request_failed_evt, 3, true},
 	{ 0x18, "LE Periodic Advertising Sync Transfer Received",
 					le_per_adv_sync_trans_rec_evt, 19,
 					true},
-- 
2.24.1


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

* Re: [PATCH 2/8] monitor: Decode LE Periodic Advertising Sync Transfer Received Event
  2020-01-07  9:18 ` [PATCH 2/8] monitor: Decode LE Periodic Advertising Sync Transfer Received Event Szymon Czapracki
@ 2020-01-07 23:43   ` Luiz Augusto von Dentz
  2020-01-08  9:53     ` Szymon Janc
  0 siblings, 1 reply; 13+ messages in thread
From: Luiz Augusto von Dentz @ 2020-01-07 23:43 UTC (permalink / raw)
  To: Szymon Czapracki; +Cc: linux-bluetooth

Hi Szymon,

On Tue, Jan 7, 2020 at 1:20 AM Szymon Czapracki
<szymon.czapracki@codecoup.pl> wrote:
>
> Change-Id: I5a7c2d36ca5aee61441c2aab6adeb16058ab062f
> ---
>  monitor/bt.h     | 14 ++++++++++++++
>  monitor/packet.c | 27 +++++++++++++++++++++++++++
>  2 files changed, 41 insertions(+)
>
> diff --git a/monitor/bt.h b/monitor/bt.h
> index ecf3782c9..e14c1771f 100644
> --- a/monitor/bt.h
> +++ b/monitor/bt.h
> @@ -3140,6 +3140,20 @@ struct bt_hci_evt_le_chan_select_alg {
>         uint8_t  algorithm;
>  } __attribute__ ((packed));
>
> +#define BT_HCI_EVT_LE_PER_ADV_SYNC_TRANS_REC           0x18
> +struct bt_hci_evt_le_per_adv_sync_trans_rec {
> +       uint8_t  status;
> +       uint16_t handle;
> +       uint16_t service_data;
> +       uint16_t sync_handle;
> +       uint8_t  sid;
> +       uint8_t  addr_type;
> +       uint8_t  addr[6];
> +       uint8_t  phy;
> +       uint16_t interval;
> +       uint8_t  clock_accuracy;
> +} __attribute__ ((packed));
> +
>  #define BT_HCI_ERR_SUCCESS                     0x00
>  #define BT_HCI_ERR_UNKNOWN_COMMAND             0x01
>  #define BT_HCI_ERR_UNKNOWN_CONN_ID             0x02
> diff --git a/monitor/packet.c b/monitor/packet.c
> index 64f75cf8e..76bb9f239 100644
> --- a/monitor/packet.c
> +++ b/monitor/packet.c
> @@ -600,6 +600,12 @@ static void print_addr_type(const char *label, uint8_t addr_type)
>         case 0x01:
>                 str = "Random";
>                 break;
> +       case 0x02:
> +               str = "Public Identity Address";
> +               break;
> +       case 0x03:
> +               str = "Random Identity Address";
> +               break;

Usually the term Address is already part of the label so we don't need
to repeat here, Random Identity also doesn't sound right, it should
probably be Static Random or perhaps have Resolved Public and Resolved
Static Random to indicate they are actually resolved address from RPA.

>         default:
>                 str = "Reserved";
>                 break;
> @@ -9788,6 +9794,24 @@ static void le_chan_select_alg_evt(const void *data, uint8_t size)
>         print_field("Algorithm: %s (0x%2.2x)", str, evt->algorithm);
>  }
>
> +static void le_per_adv_sync_trans_rec_evt(const void *data, uint8_t size)
> +{
> +       const struct bt_hci_evt_le_per_adv_sync_trans_rec *evt = data;
> +
> +       print_status(evt->status);
> +       print_field("Handle: %d", evt->handle);
> +       print_field("Connection handle: %d", evt->handle);
> +       print_field("Service data: 0x%4.4x", evt->service_data);
> +       print_field("Sync handle: %d", evt->sync_handle);
> +       print_field("SID: 0x%2.2x", evt->sid);
> +       print_addr_type("Address type:", evt->addr_type);
> +       print_addr("Addres:", evt->addr, evt->addr_type);
> +       print_le_phy("PHY:", evt->phy);
> +       print_field("Periodic advertising Interval: %.3f",
> +                                                       1.25 * evt->interval);
> +       print_clock_accuracy(evt->clock_accuracy);
> +}
> +
>  struct subevent_data {
>         uint8_t subevent;
>         const char *str;
> @@ -9871,6 +9895,9 @@ static const struct subevent_data le_meta_event_table[] = {
>                                 le_scan_req_received_evt, 8, true},
>         { 0x14, "LE Channel Selection Algorithm",
>                                 le_chan_select_alg_evt, 3, true},
> +       { 0x18, "LE Periodic Advertising Sync Transfer Received",
> +                                       le_per_adv_sync_trans_rec_evt, 19,
> +                                       true},
>         { }
>  };
>
> --
> 2.24.1
>


-- 
Luiz Augusto von Dentz

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

* Re: [PATCH 4/8] monitor: Decode LE Periodic Advertising Sync Transfer command
  2020-01-07  9:18 ` [PATCH 4/8] monitor: Decode LE Periodic Advertising Sync Transfer command Szymon Czapracki
@ 2020-01-07 23:47   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 13+ messages in thread
From: Luiz Augusto von Dentz @ 2020-01-07 23:47 UTC (permalink / raw)
  To: Szymon Czapracki; +Cc: linux-bluetooth

Hi Szymon,

On Tue, Jan 7, 2020 at 1:20 AM Szymon Czapracki
<szymon.czapracki@codecoup.pl> wrote:
>
> < HCI Command: LE Periodic Advertising Sync Transfer (0x08|0x005a) plen 6
>         Connection handle: 1
>         Service data: 0x0001
>         Sync handle: 1
> > HCI Event: Command Status (0x0f) plen 4
>       LE Periodic Advertising Sync Transfer (0x08|0x005a) ncmd 1
>         Status: Unknown HCI Command (0x01)
>
> Change-Id: I9009c6c2299cc5e56bb94ddd46e8accbacbcc800\

Looks like the gerrit Change-Id had sleep in.

> ---
>  monitor/bt.h     |  7 +++++++
>  monitor/packet.c | 19 +++++++++++++++++++
>  2 files changed, 26 insertions(+)
>
> diff --git a/monitor/bt.h b/monitor/bt.h
> index bb373b528..efaf80f55 100644
> --- a/monitor/bt.h
> +++ b/monitor/bt.h
> @@ -2467,6 +2467,13 @@ struct bt_hci_cmd_set_periodic_adv_rec_enable {
>         uint8_t  enable;
>  } __attribute__ ((packed));
>
> +#define BT_HCI_CMD_PERIODIC_SYNC_TRANS 0x205a
> +struct bt_hci_cmd_periodic_sync_trans {
> +       uint16_t handle;
> +       uint16_t service_data;
> +       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 c1e449a68..06fd72537 100644
> --- a/monitor/packet.c
> +++ b/monitor/packet.c
> @@ -4025,6 +4025,13 @@ static void status_rsp(const void *data, uint8_t size)
>         print_status(status);
>  }
>
> +static void status_handle_rsp(const void *data, uint8_t size)
> +{
> +       uint8_t status = *((const uint8_t *) data);
> +       print_status(status);
> +       print_field("Connection handle: %d", get_u8(data + 1));
> +}
> +
>  static void status_bdaddr_rsp(const void *data, uint8_t size)
>  {
>         uint8_t status = *((const uint8_t *) data);
> @@ -7598,6 +7605,15 @@ static void le_periodic_adv_rec_enable(const void *data, uint8_t size)
>         print_enable("Reporting", cmd->enable);
>  }
>
> +static void le_periodic_adv_sync_trans(const void *data, uint8_t size)
> +{
> +       const struct bt_hci_cmd_periodic_sync_trans *cmd = data;
> +
> +       print_field("Connection handle: %d", cmd->handle);
> +       print_field("Service data: 0x%4.4x", cmd->service_data);
> +       print_field("Sync handle: %d", cmd->sync_handle);
> +}
> +
>  struct opcode_data {
>         uint16_t opcode;
>         int bit;
> @@ -8394,6 +8410,9 @@ static const struct opcode_data opcode_table[] = {
>         { 0x2059, 325, "LE Periodic Advertising Receive Enable",
>                                 le_periodic_adv_rec_enable, 3, true,
>                                 status_rsp, 1, true },
> +       { 0x205a, 326, "LE Periodic Advertising Sync Transfer",
> +                               le_periodic_adv_sync_trans, 6, true,
> +                               status_handle_rsp, 3, true },
>         { }
>  };
>
> --
> 2.24.1
>


-- 
Luiz Augusto von Dentz

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

* Re: [PATCH 5/8] monitor: Decode LE Periodic Advertising Set Info Transfer command
  2020-01-07  9:18 ` [PATCH 5/8] monitor: Decode LE Periodic Advertising Set Info " Szymon Czapracki
@ 2020-01-07 23:48   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 13+ messages in thread
From: Luiz Augusto von Dentz @ 2020-01-07 23:48 UTC (permalink / raw)
  To: Szymon Czapracki; +Cc: linux-bluetooth

Hi Szymon,

On Tue, Jan 7, 2020 at 1:21 AM Szymon Czapracki
<szymon.czapracki@codecoup.pl> wrote:
>
> < HCI Command: LE Periodic Advertising Set Info Transfer (0x08|0x005b) plen 5
>        Connection handle: 1
>        Service data: 0x0000
>        Advertising handle: 0
> > HCI Event: Command Status (0x0f) plen 4
>      LE Periodic Advertising Set Info Transfer (0x08|0x005b) ncmd 1
>        Status: Unknown HCI Command (0x01)
>
> Change-Id: I4167e85f29e20304d1b72ec537ece70a68e8407e

Here as well.

> ---
>  monitor/bt.h     |  7 +++++++
>  monitor/packet.c | 12 ++++++++++++
>  2 files changed, 19 insertions(+)
>
> diff --git a/monitor/bt.h b/monitor/bt.h
> index efaf80f55..f8422ccc9 100644
> --- a/monitor/bt.h
> +++ b/monitor/bt.h
> @@ -2474,6 +2474,13 @@ struct bt_hci_cmd_periodic_sync_trans {
>         uint16_t sync_handle;
>  } __attribute__ ((packed));
>
> +#define BT_HCI_CMD_PERIODIC_ADV_SET_INFO_TRANS 0x205b
> +struct bt_hci_cmd_periodic_adv_set_info_trans {
> +       uint16_t handle;
> +       uint16_t service_data;
> +       uint16_t adv_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 06fd72537..3c3399c0c 100644
> --- a/monitor/packet.c
> +++ b/monitor/packet.c
> @@ -7614,6 +7614,15 @@ static void le_periodic_adv_sync_trans(const void *data, uint8_t size)
>         print_field("Sync handle: %d", cmd->sync_handle);
>  }
>
> +static void le_periodic_adv_set_info_trans(const void *data, uint8_t size)
> +{
> +       const struct bt_hci_cmd_periodic_adv_set_info_trans *cmd = data;
> +
> +       print_field("Connection handle: %d", cmd->handle);
> +       print_field("Service data: 0x%4.4x", cmd->service_data);
> +       print_field("Advertising handle: %d", cmd->adv_handle);
> +}
> +
>  struct opcode_data {
>         uint16_t opcode;
>         int bit;
> @@ -8413,6 +8422,9 @@ static const struct opcode_data opcode_table[] = {
>         { 0x205a, 326, "LE Periodic Advertising Sync Transfer",
>                                 le_periodic_adv_sync_trans, 6, true,
>                                 status_handle_rsp, 3, true },
> +       { 0x205b, 327, "LE Periodic Advertising Set Info Transfer",
> +                               le_periodic_adv_set_info_trans, 5, true,
> +                               status_handle_rsp, 3, true },
>         { }
>  };
>
> --
> 2.24.1
>


-- 
Luiz Augusto von Dentz

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

* Re: [PATCH 2/8] monitor: Decode LE Periodic Advertising Sync Transfer Received Event
  2020-01-07 23:43   ` Luiz Augusto von Dentz
@ 2020-01-08  9:53     ` Szymon Janc
  2020-01-08 18:22       ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 13+ messages in thread
From: Szymon Janc @ 2020-01-08  9:53 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: Szymon Czapracki, linux-bluetooth

Hi,

On Wednesday, 8 January 2020 00:43:44 CET Luiz Augusto von Dentz wrote:
> Hi Szymon,
> 
> On Tue, Jan 7, 2020 at 1:20 AM Szymon Czapracki
> 
> <szymon.czapracki@codecoup.pl> wrote:
> > Change-Id: I5a7c2d36ca5aee61441c2aab6adeb16058ab062f
> > ---
> > 
> >  monitor/bt.h     | 14 ++++++++++++++
> >  monitor/packet.c | 27 +++++++++++++++++++++++++++
> >  2 files changed, 41 insertions(+)
> > 
> > diff --git a/monitor/bt.h b/monitor/bt.h
> > index ecf3782c9..e14c1771f 100644
> > --- a/monitor/bt.h
> > +++ b/monitor/bt.h
> > @@ -3140,6 +3140,20 @@ struct bt_hci_evt_le_chan_select_alg {
> > 
> >         uint8_t  algorithm;
> >  
> >  } __attribute__ ((packed));
> > 
> > +#define BT_HCI_EVT_LE_PER_ADV_SYNC_TRANS_REC           0x18
> > +struct bt_hci_evt_le_per_adv_sync_trans_rec {
> > +       uint8_t  status;
> > +       uint16_t handle;
> > +       uint16_t service_data;
> > +       uint16_t sync_handle;
> > +       uint8_t  sid;
> > +       uint8_t  addr_type;
> > +       uint8_t  addr[6];
> > +       uint8_t  phy;
> > +       uint16_t interval;
> > +       uint8_t  clock_accuracy;
> > +} __attribute__ ((packed));
> > +
> > 
> >  #define BT_HCI_ERR_SUCCESS                     0x00
> >  #define BT_HCI_ERR_UNKNOWN_COMMAND             0x01
> >  #define BT_HCI_ERR_UNKNOWN_CONN_ID             0x02
> > 
> > diff --git a/monitor/packet.c b/monitor/packet.c
> > index 64f75cf8e..76bb9f239 100644
> > --- a/monitor/packet.c
> > +++ b/monitor/packet.c
> > @@ -600,6 +600,12 @@ static void print_addr_type(const char *label,
> > uint8_t addr_type)> 
> >         case 0x01:
> >                 str = "Random";
> >                 break;
> > 
> > +       case 0x02:
> > +               str = "Public Identity Address";
> > +               break;
> > +       case 0x03:
> > +               str = "Random Identity Address";
> > +               break;
> 
> Usually the term Address is already part of the label so we don't need
> to repeat here, Random Identity also doesn't sound right, it should
> probably be Static Random or perhaps have Resolved Public and Resolved
> Static Random to indicate they are actually resolved address from RPA.

Those names are from spec actually but I agree that those are somewhat odd.
How about just using print_peer_addr_type() to print this?
Then we have: public, random, resolved public and resolved Random. This is
short and also makes output consistent with other events.

> 
> >         default:
> >                 str = "Reserved";
> >                 break;
> > 
> > @@ -9788,6 +9794,24 @@ static void le_chan_select_alg_evt(const void
> > *data, uint8_t size)> 
> >         print_field("Algorithm: %s (0x%2.2x)", str, evt->algorithm);
> >  
> >  }
> > 
> > +static void le_per_adv_sync_trans_rec_evt(const void *data, uint8_t size)
> > +{
> > +       const struct bt_hci_evt_le_per_adv_sync_trans_rec *evt = data;
> > +
> > +       print_status(evt->status);
> > +       print_field("Handle: %d", evt->handle);
> > +       print_field("Connection handle: %d", evt->handle);
> > +       print_field("Service data: 0x%4.4x", evt->service_data);
> > +       print_field("Sync handle: %d", evt->sync_handle);
> > +       print_field("SID: 0x%2.2x", evt->sid);
> > +       print_addr_type("Address type:", evt->addr_type);
> > +       print_addr("Addres:", evt->addr, evt->addr_type);
> > +       print_le_phy("PHY:", evt->phy);
> > +       print_field("Periodic advertising Interval: %.3f",
> > +                                                       1.25 *
> > evt->interval); +       print_clock_accuracy(evt->clock_accuracy);
> > +}
> > +
> > 
> >  struct subevent_data {
> >  
> >         uint8_t subevent;
> >         const char *str;
> > 
> > @@ -9871,6 +9895,9 @@ static const struct subevent_data
> > le_meta_event_table[] = {> 
> >                                 le_scan_req_received_evt, 8, true},
> >         
> >         { 0x14, "LE Channel Selection Algorithm",
> >         
> >                                 le_chan_select_alg_evt, 3, true},
> > 
> > +       { 0x18, "LE Periodic Advertising Sync Transfer Received",
> > +                                       le_per_adv_sync_trans_rec_evt, 19,
> > +                                       true},
> > 
> >         { }
> >  
> >  };
> > 
> > --
> > 2.24.1


-- 
pozdrawiam
Szymon Janc



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

* Re: [PATCH 2/8] monitor: Decode LE Periodic Advertising Sync Transfer Received Event
  2020-01-08  9:53     ` Szymon Janc
@ 2020-01-08 18:22       ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 13+ messages in thread
From: Luiz Augusto von Dentz @ 2020-01-08 18:22 UTC (permalink / raw)
  To: Szymon Janc; +Cc: Szymon Czapracki, linux-bluetooth

Hi Szymon,

On Wed, Jan 8, 2020 at 1:53 AM Szymon Janc <szymon.janc@codecoup.pl> wrote:
>
> Hi,
>
> On Wednesday, 8 January 2020 00:43:44 CET Luiz Augusto von Dentz wrote:
> > Hi Szymon,
> >
> > On Tue, Jan 7, 2020 at 1:20 AM Szymon Czapracki
> >
> > <szymon.czapracki@codecoup.pl> wrote:
> > > Change-Id: I5a7c2d36ca5aee61441c2aab6adeb16058ab062f
> > > ---
> > >
> > >  monitor/bt.h     | 14 ++++++++++++++
> > >  monitor/packet.c | 27 +++++++++++++++++++++++++++
> > >  2 files changed, 41 insertions(+)
> > >
> > > diff --git a/monitor/bt.h b/monitor/bt.h
> > > index ecf3782c9..e14c1771f 100644
> > > --- a/monitor/bt.h
> > > +++ b/monitor/bt.h
> > > @@ -3140,6 +3140,20 @@ struct bt_hci_evt_le_chan_select_alg {
> > >
> > >         uint8_t  algorithm;
> > >
> > >  } __attribute__ ((packed));
> > >
> > > +#define BT_HCI_EVT_LE_PER_ADV_SYNC_TRANS_REC           0x18
> > > +struct bt_hci_evt_le_per_adv_sync_trans_rec {
> > > +       uint8_t  status;
> > > +       uint16_t handle;
> > > +       uint16_t service_data;
> > > +       uint16_t sync_handle;
> > > +       uint8_t  sid;
> > > +       uint8_t  addr_type;
> > > +       uint8_t  addr[6];
> > > +       uint8_t  phy;
> > > +       uint16_t interval;
> > > +       uint8_t  clock_accuracy;
> > > +} __attribute__ ((packed));
> > > +
> > >
> > >  #define BT_HCI_ERR_SUCCESS                     0x00
> > >  #define BT_HCI_ERR_UNKNOWN_COMMAND             0x01
> > >  #define BT_HCI_ERR_UNKNOWN_CONN_ID             0x02
> > >
> > > diff --git a/monitor/packet.c b/monitor/packet.c
> > > index 64f75cf8e..76bb9f239 100644
> > > --- a/monitor/packet.c
> > > +++ b/monitor/packet.c
> > > @@ -600,6 +600,12 @@ static void print_addr_type(const char *label,
> > > uint8_t addr_type)>
> > >         case 0x01:
> > >                 str = "Random";
> > >                 break;
> > >
> > > +       case 0x02:
> > > +               str = "Public Identity Address";
> > > +               break;
> > > +       case 0x03:
> > > +               str = "Random Identity Address";
> > > +               break;
> >
> > Usually the term Address is already part of the label so we don't need
> > to repeat here, Random Identity also doesn't sound right, it should
> > probably be Static Random or perhaps have Resolved Public and Resolved
> > Static Random to indicate they are actually resolved address from RPA.
>
> Those names are from spec actually but I agree that those are somewhat odd.
> How about just using print_peer_addr_type() to print this?
> Then we have: public, random, resolved public and resolved Random. This is
> short and also makes output consistent with other events.

Yep, lets use that then.

> >
> > >         default:
> > >                 str = "Reserved";
> > >                 break;
> > >
> > > @@ -9788,6 +9794,24 @@ static void le_chan_select_alg_evt(const void
> > > *data, uint8_t size)>
> > >         print_field("Algorithm: %s (0x%2.2x)", str, evt->algorithm);
> > >
> > >  }
> > >
> > > +static void le_per_adv_sync_trans_rec_evt(const void *data, uint8_t size)
> > > +{
> > > +       const struct bt_hci_evt_le_per_adv_sync_trans_rec *evt = data;
> > > +
> > > +       print_status(evt->status);
> > > +       print_field("Handle: %d", evt->handle);
> > > +       print_field("Connection handle: %d", evt->handle);
> > > +       print_field("Service data: 0x%4.4x", evt->service_data);
> > > +       print_field("Sync handle: %d", evt->sync_handle);
> > > +       print_field("SID: 0x%2.2x", evt->sid);
> > > +       print_addr_type("Address type:", evt->addr_type);
> > > +       print_addr("Addres:", evt->addr, evt->addr_type);
> > > +       print_le_phy("PHY:", evt->phy);
> > > +       print_field("Periodic advertising Interval: %.3f",
> > > +                                                       1.25 *
> > > evt->interval); +       print_clock_accuracy(evt->clock_accuracy);
> > > +}
> > > +
> > >
> > >  struct subevent_data {
> > >
> > >         uint8_t subevent;
> > >         const char *str;
> > >
> > > @@ -9871,6 +9895,9 @@ static const struct subevent_data
> > > le_meta_event_table[] = {>
> > >                                 le_scan_req_received_evt, 8, true},
> > >
> > >         { 0x14, "LE Channel Selection Algorithm",
> > >
> > >                                 le_chan_select_alg_evt, 3, true},
> > >
> > > +       { 0x18, "LE Periodic Advertising Sync Transfer Received",
> > > +                                       le_per_adv_sync_trans_rec_evt, 19,
> > > +                                       true},
> > >
> > >         { }
> > >
> > >  };
> > >
> > > --
> > > 2.24.1
>
>
> --
> pozdrawiam
> Szymon Janc
>
>


-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2020-01-08 18:22 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-07  9:18 [PATCH 1/8] monitor: Update periodic sync commands Szymon Czapracki
2020-01-07  9:18 ` [PATCH 2/8] monitor: Decode LE Periodic Advertising Sync Transfer Received Event Szymon Czapracki
2020-01-07 23:43   ` Luiz Augusto von Dentz
2020-01-08  9:53     ` Szymon Janc
2020-01-08 18:22       ` Luiz Augusto von Dentz
2020-01-07  9:18 ` [PATCH 3/8] monitor: Decode LE Set Periodic Advertising Receive Enable command Szymon Czapracki
2020-01-07  9:18 ` [PATCH 4/8] monitor: Decode LE Periodic Advertising Sync Transfer command Szymon Czapracki
2020-01-07 23:47   ` Luiz Augusto von Dentz
2020-01-07  9:18 ` [PATCH 5/8] monitor: Decode LE Periodic Advertising Set Info " Szymon Czapracki
2020-01-07 23:48   ` Luiz Augusto von Dentz
2020-01-07  9:18 ` [PATCH 6/8] monitor: Decode LE Set Periodic Adv Sync Transfer Parameterers command Szymon Czapracki
2020-01-07  9:18 ` [PATCH 7/8] monitor: Decode LE Set Default Periodic Adv Sync Transfer Params. command Szymon Czapracki
2020-01-07  9:18 ` [PATCH 8/8] monitor: Decode LE CTE Request Failed event Szymon Czapracki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).