From: "Michał Narajowski" <michal.narajowski@codecoup.pl>
To: linux-bluetooth@vger.kernel.org
Cc: "Michał Narajowski" <michal.narajowski@codecoup.pl>
Subject: [PATCH BlueZ 29/31] monitor: Add LE Extended Advertising Report Event decoding
Date: Tue, 6 Jun 2017 11:41:18 +0200 [thread overview]
Message-ID: <20170606094120.14541-32-michal.narajowski@codecoup.pl> (raw)
In-Reply-To: <20170606094120.14541-1-michal.narajowski@codecoup.pl>
---
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
next prev parent reply other threads:[~2017-06-06 9:41 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Michał Narajowski [this message]
2017-06-06 14:10 ` [PATCH BlueZ 29/31] monitor: Add LE Extended Advertising Report Event decoding Ł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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170606094120.14541-32-michal.narajowski@codecoup.pl \
--to=michal.narajowski@codecoup.pl \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox