Diff between b4c54f97ce9f2b477c97059cbea9082b7a7494a3 and 88727a38324214813a826afda104fbb5d8a599ac

Changed Files

File Additions Deletions Status
monitor/main.c +5 -1 modified
monitor/packet.c +9 -0 modified
monitor/packet.h +1 -0 modified

Full Patch

diff --git a/monitor/main.c b/monitor/main.c
index de48db5..faf629e 100644
--- a/monitor/main.c
+++ b/monitor/main.c
@@ -61,6 +61,7 @@ static void usage(void)
 		"\t-w, --write <file>     Save traces in btsnoop format\n"
 		"\t-a, --analyze <file>   Analyze traces in btsnoop format\n"
 		"\t-s, --server <socket>  Start monitor server socket\n"
+		"\t-p, --priority <level> Show only priority or lower\n"
 		"\t-i, --index <num>      Show only specified controller\n"
 		"\t-t, --time             Show time instead of time offset\n"
 		"\t-T, --date             Show time and date information\n"
@@ -104,7 +105,7 @@ int main(int argc, char *argv[])
 	for (;;) {
 		int opt;
 
-		opt = getopt_long(argc, argv, "r:w:a:s:i:tTSE:vh",
+		opt = getopt_long(argc, argv, "r:w:a:s:p:i:tTSE:vh",
 						main_options, NULL);
 		if (opt < 0)
 			break;
@@ -122,6 +123,9 @@ int main(int argc, char *argv[])
 		case 's':
 			control_server(optarg);
 			break;
+		case 'p':
+			packet_set_priority(optarg);
+			break;
 		case 'i':
 			if (strlen(optarg) > 3 && !strncmp(optarg, "hci", 3))
 				str = optarg + 3;
diff --git a/monitor/packet.c b/monitor/packet.c
index 8674542..1e3fc4c 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -88,6 +88,7 @@
 #define COLOR_PHY_PACKET		COLOR_BLUE
 
 static time_t time_offset = ((time_t) -1);
+static int priority_level = 6;
 static unsigned long filter_mask = 0;
 static bool index_filter = false;
 static uint16_t index_number = 0;
@@ -160,6 +161,11 @@ void packet_del_filter(unsigned long filter)
 	filter_mask &= ~filter;
 }
 
+void packet_set_priority(const char *priority)
+{
+	priority_level = atoi(priority);
+}
+
 void packet_select_index(uint16_t index)
 {
 	filter_mask &= ~PACKET_FILTER_SHOW_INDEX;
@@ -8717,6 +8723,9 @@ void packet_user_logging(struct timeval *tv, struct ucred *cred,
 	const char *label;
 	const char *color;
 
+	if (priority > priority_level)
+		return;
+
 	switch (priority) {
 	case 0x03:
 		color = COLOR_ERROR;
diff --git a/monitor/packet.h b/monitor/packet.h
index 218a63b..322f101 100644
--- a/monitor/packet.h
+++ b/monitor/packet.h
@@ -38,6 +38,7 @@ void packet_set_filter(unsigned long filter);
 void packet_add_filter(unsigned long filter);
 void packet_del_filter(unsigned long filter);
 
+void packet_set_priority(const char *priority);
 void packet_select_index(uint16_t index);
 
 void packet_hexdump(const unsigned char *buf, uint16_t len);