summaryrefslogtreecommitdiff
path: root/monitor/analyze.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2021-08-03 17:04:47 +0200
committerMarcel Holtmann <marcel@holtmann.org>2021-08-03 17:04:47 +0200
commitf9b8fac243a2b21ed3d06b9892b886cc824e302e (patch)
treeef49cc60c881fbef30fb8a7570ae0478fceabd7d /monitor/analyze.c
parent30a4fdcbfe8de30503012733ebdb3dc58ccd73fb (diff)
downloadbluez-f9b8fac243a2b21ed3d06b9892b886cc824e302e.tar.gz
monitor: Count number of control messages
Diffstat (limited to 'monitor/analyze.c')
-rw-r--r--monitor/analyze.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/monitor/analyze.c b/monitor/analyze.c
index 9f6d98619..aac5c39d4 100644
--- a/monitor/analyze.c
+++ b/monitor/analyze.c
@@ -38,6 +38,7 @@ struct hci_dev {
unsigned long vendor_diag;
unsigned long system_note;
unsigned long user_log;
+ unsigned long ctrl_msg;
unsigned long unknown;
uint16_t manufacturer;
};
@@ -78,6 +79,7 @@ static void dev_destroy(void *data)
printf(" %lu vendor diagnostics\n", dev->vendor_diag);
printf(" %lu system notes\n", dev->system_note);
printf(" %lu user logs\n", dev->user_log);
+ printf(" %lu control messages \n", dev->ctrl_msg);
printf(" %lu unknown opcodes\n", dev->unknown);
printf("\n");
@@ -301,6 +303,18 @@ static void user_log(struct timeval *tv, uint16_t index,
dev->user_log++;
}
+static void ctrl_msg(struct timeval *tv, uint16_t index,
+ const void *data, uint16_t size)
+{
+ struct hci_dev *dev;
+
+ dev = dev_lookup(index);
+ if (!dev)
+ return;
+
+ dev->ctrl_msg++;
+}
+
static void iso_pkt(struct timeval *tv, uint16_t index,
const void *data, uint16_t size)
{
@@ -398,6 +412,12 @@ void analyze_trace(const char *path)
case BTSNOOP_OPCODE_USER_LOGGING:
user_log(&tv, index, buf, pktlen);
break;
+ case BTSNOOP_OPCODE_CTRL_OPEN:
+ case BTSNOOP_OPCODE_CTRL_CLOSE:
+ case BTSNOOP_OPCODE_CTRL_COMMAND:
+ case BTSNOOP_OPCODE_CTRL_EVENT:
+ ctrl_msg(&tv, index, buf, pktlen);
+ break;
case BTSNOOP_OPCODE_ISO_TX_PKT:
case BTSNOOP_OPCODE_ISO_RX_PKT:
iso_pkt(&tv, index, buf, pktlen);