From 008093fc1c05fab0a6194f5405de879569997641 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 25 Apr 2017 14:56:34 +0300 Subject: [PATCH] monitor: Add option -A/--a2dp to dump A2DP stream data This is similar to SCO which disable audio dumping by default so only signalling data is shown: < ACL Data TX: Handle 256 flags 0x02 dlen 850 #6041 11:32:29.299212 Channel: 451 len 846 [PSM 25 mode 0] {chan 2} --- monitor/avdtp.c | 3 ++- monitor/main.c | 7 ++++++- monitor/packet.c | 5 +++++ monitor/packet.h | 2 ++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/monitor/avdtp.c b/monitor/avdtp.c index 3524faa04..006daf33f 100644 --- a/monitor/avdtp.c +++ b/monitor/avdtp.c @@ -776,7 +776,8 @@ void avdtp_packet(const struct l2cap_frame *frame) ret = avdtp_signalling_packet(&avdtp_frame); break; default: - packet_hexdump(frame->data, frame->size); + if (packet_has_filter(PACKET_FILTER_SHOW_A2DP_STREAM)) + packet_hexdump(frame->data, frame->size); return; } diff --git a/monitor/main.c b/monitor/main.c index f9bca221a..b4e9a6ab9 100644 --- a/monitor/main.c +++ b/monitor/main.c @@ -69,6 +69,7 @@ static void usage(void) "\t-t, --time Show time instead of time offset\n" "\t-T, --date Show time and date information\n" "\t-S, --sco Dump SCO traffic\n" + "\t-A, --a2dp Dump A2DP stream traffic\n" "\t-E, --ellisys [ip] Send Ellisys HCI Injection\n" "\t-h, --help Show help options\n"); } @@ -85,6 +86,7 @@ static const struct option main_options[] = { { "time", no_argument, NULL, 't' }, { "date", no_argument, NULL, 'T' }, { "sco", no_argument, NULL, 'S' }, + { "a2dp", no_argument, NULL, 'A' }, { "ellisys", required_argument, NULL, 'E' }, { "todo", no_argument, NULL, '#' }, { "version", no_argument, NULL, 'v' }, @@ -113,7 +115,7 @@ int main(int argc, char *argv[]) for (;;) { int opt; - opt = getopt_long(argc, argv, "d:r:w:a:s:p:i:tTSE:vh", + opt = getopt_long(argc, argv, "d:r:w:a:s:p:i:tTSAE:vh", main_options, NULL); if (opt < 0) break; @@ -167,6 +169,9 @@ int main(int argc, char *argv[]) case 'S': filter_mask |= PACKET_FILTER_SHOW_SCO_DATA; break; + case 'A': + filter_mask |= PACKET_FILTER_SHOW_A2DP_STREAM; + break; case 'E': ellisys_server = optarg; ellisys_port = 24352; diff --git a/monitor/packet.c b/monitor/packet.c index 2e09dda04..a93140aec 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -221,6 +221,11 @@ static uint8_t get_type(uint16_t handle) return 0xff; } +bool packet_has_filter(unsigned long filter) +{ + return filter_mask & filter; +} + void packet_set_filter(unsigned long filter) { filter_mask = filter; diff --git a/monitor/packet.h b/monitor/packet.h index 354f4fee5..a4fdcc642 100644 --- a/monitor/packet.h +++ b/monitor/packet.h @@ -33,7 +33,9 @@ #define PACKET_FILTER_SHOW_TIME_OFFSET (1 << 3) #define PACKET_FILTER_SHOW_ACL_DATA (1 << 4) #define PACKET_FILTER_SHOW_SCO_DATA (1 << 5) +#define PACKET_FILTER_SHOW_A2DP_STREAM (1 << 6) +bool packet_has_filter(unsigned long filter); void packet_set_filter(unsigned long filter); void packet_add_filter(unsigned long filter); void packet_del_filter(unsigned long filter); -- 2.47.3