2022-09-08 14:59:40

by Gix, Brian

[permalink] [raw]
Subject: [PATCH BlueZ v4 1/2] monitor: Add ADV Monitor events to btmon parser

Add missing ADV Monitor MGMT events
---
monitor/packet.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)

diff --git a/monitor/packet.c b/monitor/packet.c
index 46587e087..4f2172bdf 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -14914,6 +14914,37 @@ static void mgmt_controller_resume_evt(const void *data, uint16_t size)
mgmt_print_address(data, addr_type);
}

+static void mgmt_adv_monitor_device_found_evt(const void *data, uint16_t size)
+{
+ uint16_t handle = get_le16(data);
+ const uint8_t *addr = data + 2;
+ uint8_t addr_type = get_u8(data + 8);
+ int8_t rssi = get_s8(data + 9);
+ uint32_t flags = get_le32(data + 10);
+ uint16_t ad_data_len = get_le16(data + 14);
+ const uint8_t *ad_data = data + 16;
+
+ print_field("Handle: %d", handle);
+ print_bdaddr(addr);
+ print_field("Addr Type: %d", addr_type);
+ print_field("RSSI: %d", rssi);
+ mgmt_print_device_flags(flags);
+ print_field("AD Data Len: %d", ad_data_len);
+ size -= 16;
+ print_hex_field("AD Data", ad_data, size);
+}
+
+static void mgmt_adv_monitor_device_lost_evt(const void *data, uint16_t size)
+{
+ uint16_t handle = get_le16(data);
+ const uint8_t *addr = data + 2;
+ uint8_t addr_type = get_u8(data + 8);
+
+ print_field("Handle: %d", handle);
+ print_bdaddr(addr);
+ print_field("Addr Type: %d", addr_type);
+}
+
static const struct mgmt_data mgmt_event_table[] = {
{ 0x0001, "Command Complete",
mgmt_command_complete_evt, 3, false },
@@ -15003,6 +15034,10 @@ static const struct mgmt_data mgmt_event_table[] = {
mgmt_controller_suspend_evt, 1, true },
{ 0x002e, "Controller Resumed",
mgmt_controller_resume_evt, 8, true },
+ { 0x002f, "ADV Monitor Device Found",
+ mgmt_adv_monitor_device_found_evt, 16, false },
+ { 0x0030, "ADV Monitor Device Lost",
+ mgmt_adv_monitor_device_lost_evt, 9, true },
{ }
};

--
2.37.2


2022-09-08 15:13:16

by Gix, Brian

[permalink] [raw]
Subject: [PATCH BlueZ v4 2/2] monitor: Add mesh MGMT cmds/events to btmon parser

Sample Output:
@ MGMT Command: Read Mesh Features (0x0058) plen 0
@ MGMT Event: Command Complete (0x0001) plen 7
Read Mesh Features (0x0058) plen 4
Status: Success (0x00)
Index: 0
Max Handles: 3
Used Handles: 0

@ MGMT Command: Set Mesh Receiver (0x0057) plen 9
Enable: 1
Window: 4096
Period: 4096
Num AD Types: 3
AD Type: 42
AD Type: 43
AD Type: 41
@ MGMT Event: Command Complete (0x0001) plen 3
Set Mesh Receiver (0x0057) plen 0
Status: Success (0x00)

@ MGMT Command: Mesh Send (0x0059) plen 43
Address: 00:00:00:00:00:00 (OUI 00-00-00)
Addr Type: 2
Instant: 0x0000000000000000
Delay: 0
Count: 1
Data Length: 24
Data: 172b01002dda0c2491537ae2000000009de2120a725038b2
@ MGMT Event: Command Complete (0x0001) plen 4
Mesh Send (0x0059) plen 1
Status: Success (0x00)
Handle: 3

@ MGMT Event: Mesh Packet Complete (0x0032) plen 1
Handle: 3
---
monitor/packet.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 111 insertions(+)

diff --git a/monitor/packet.c b/monitor/packet.c
index 4f2172bdf..1344fd5b2 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -14191,6 +14191,74 @@ static void mgmt_remove_adv_monitor_patterns_rsp(const void *data,
print_field("Handle: %d", handle);
}

+static void mgmt_set_mesh_receiver_cmd(const void *data, uint16_t size)
+{
+ uint8_t enable = get_u8(data);
+ uint16_t window = get_le16(data + 1);
+ uint16_t period = get_le16(data + 3);
+ uint8_t num_ad_types = get_u8(data + 5);
+ const uint8_t *ad_types = data + 6;
+
+ print_field("Enable: %d", enable);
+ print_field("Window: %d", window);
+ print_field("Period: %d", period);
+ print_field("Num AD Types: %d", num_ad_types);
+ size -= 6;
+
+ while (size--)
+ print_field(" AD Type: %d", *ad_types++);
+}
+
+static void mgmt_read_mesh_features_rsp(const void *data, uint16_t size)
+{
+ uint16_t index = get_le16(data);
+ uint8_t max_handles = get_u8(data + 2);
+ uint8_t used_handles = get_u8(data + 3);
+ const uint8_t *handles = data + 4;
+
+ print_field("Index: %d", index);
+ print_field("Max Handles: %d", max_handles);
+ print_field("Used Handles: %d", used_handles);
+ size -= 4;
+
+ while (size--)
+ print_field(" Used Handle: %d", *handles++);
+}
+
+static void mgmt_mesh_send_cmd(const void *data, uint16_t size)
+{
+ const uint8_t *addr = data;
+ uint8_t addr_type = get_u8(data + 6);
+ uint64_t instant = get_le64(data + 7);
+ uint16_t delay = get_le16(data + 15);
+ uint8_t cnt = get_u8(data + 17);
+ uint8_t adv_data_len = get_u8(data + 18);
+
+ data += 19;
+ size -= 19;
+ print_bdaddr(addr);
+ print_field("Addr Type: %d", addr_type);
+ print_field("Instant: 0x%16.16" PRIx64, instant);
+ print_field("Delay: %d", delay);
+ print_field("Count: %d", cnt);
+ print_field("Data Length: %d", adv_data_len);
+ print_hex_field("Data", data, size);
+}
+
+static void mgmt_mesh_send_rsp(const void *data, uint16_t size)
+{
+ uint8_t handle = get_u8(data);
+
+ print_field("Handle: %d", handle);
+}
+
+static void mgmt_mesh_send_cancel_cmd(const void *data, uint16_t size)
+{
+ uint8_t handle = get_u8(data);
+
+ print_field("Handle: %d", handle);
+}
+
struct mgmt_data {
uint16_t opcode;
const char *str;
@@ -14448,6 +14516,18 @@ static const struct mgmt_data mgmt_command_table[] = {
mgmt_add_adv_monitor_patterns_rssi_cmd, 8,
false,
mgmt_add_adv_monitor_patterns_rsp, 2, true},
+ { 0x0057, "Set Mesh Receiver",
+ mgmt_set_mesh_receiver_cmd, 6, false,
+ mgmt_null_rsp, 0, true},
+ { 0x0058, "Read Mesh Features",
+ mgmt_null_cmd, 0, true,
+ mgmt_read_mesh_features_rsp, 4, false},
+ { 0x0059, "Mesh Send",
+ mgmt_mesh_send_cmd, 19, false,
+ mgmt_mesh_send_rsp, 1, true},
+ { 0x0056, "Mesh Send Cancel",
+ mgmt_mesh_send_cancel_cmd, 1, true,
+ mgmt_null_rsp, 0, true},
{ }
};

@@ -14945,6 +15025,33 @@ static void mgmt_adv_monitor_device_lost_evt(const void *data, uint16_t size)
print_field("Addr Type: %d", addr_type);
}

+static void mgmt_mesh_device_found_evt(const void *data, uint16_t size)
+{
+ const uint8_t *addr = data;
+ uint8_t addr_type = get_u8(data + 6);
+ int8_t rssi = get_s8(data + 7);
+ uint64_t instant = get_le64(data + 8);
+ uint32_t flags = get_le32(data + 16);
+ uint16_t eir_len = get_le16(data + 20);
+ const uint8_t *eir_data = data + 22;
+
+ print_bdaddr(addr);
+ print_field("Addr Type: %d", addr_type);
+ print_field("RSSI: %d", rssi);
+ print_field("Instant: 0x%16.16" PRIx64, instant);
+ mgmt_print_device_flags(flags);
+ print_field("EIR Length: %d", eir_len);
+ size -= 22;
+ print_hex_field("EIR Data", eir_data, size);
+}
+
+static void mgmt_mesh_packet_cmplt_evt(const void *data, uint16_t size)
+{
+ uint8_t handle = get_u8(data);
+
+ print_field("Handle: %d", handle);
+}
+
static const struct mgmt_data mgmt_event_table[] = {
{ 0x0001, "Command Complete",
mgmt_command_complete_evt, 3, false },
@@ -15038,6 +15145,10 @@ static const struct mgmt_data mgmt_event_table[] = {
mgmt_adv_monitor_device_found_evt, 16, false },
{ 0x0030, "ADV Monitor Device Lost",
mgmt_adv_monitor_device_lost_evt, 9, true },
+ { 0x0031, "Mesh Device Found",
+ mgmt_mesh_device_found_evt, 22, false },
+ { 0x0032, "Mesh Packet Complete",
+ mgmt_mesh_packet_cmplt_evt, 1, true },
{ }
};

--
2.37.2

2022-09-08 16:16:11

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ,v4,1/2] monitor: Add ADV Monitor events to btmon parser

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=675287

---Test result---

Test Summary:
CheckPatch PASS 3.03 seconds
GitLint PASS 1.96 seconds
Prep - Setup ELL PASS 27.49 seconds
Build - Prep PASS 0.85 seconds
Build - Configure PASS 8.75 seconds
Build - Make PASS 995.15 seconds
Make Check PASS 11.86 seconds
Make Check w/Valgrind PASS 295.52 seconds
Make Distcheck PASS 245.99 seconds
Build w/ext ELL - Configure PASS 8.84 seconds
Build w/ext ELL - Make PASS 86.53 seconds
Incremental Build w/ patches PASS 204.14 seconds
Scan Build PASS 571.23 seconds



---
Regards,
Linux Bluetooth

2022-09-08 21:56:23

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH BlueZ v4 1/2] monitor: Add ADV Monitor events to btmon parser

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <[email protected]>:

On Thu, 8 Sep 2022 07:55:54 -0700 you wrote:
> Add missing ADV Monitor MGMT events
> ---
> monitor/packet.c | 35 +++++++++++++++++++++++++++++++++++
> 1 file changed, 35 insertions(+)

Here is the summary with links:
- [BlueZ,v4,1/2] monitor: Add ADV Monitor events to btmon parser
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=0940cba00348
- [BlueZ,v4,2/2] monitor: Add mesh MGMT cmds/events to btmon parser
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=9d8fd3c28bbf

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html