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}
This commit is contained in:
Luiz Augusto von Dentz 2017-04-25 14:56:34 +03:00
parent 6db3470c2e
commit 008093fc1c
4 changed files with 15 additions and 2 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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);