diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2012-10-31 18:28:41 -0700 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-10-31 18:28:41 -0700 |
commit | 4cd79c5a4042f0a682dd06da42f6377827293e5f (patch) | |
tree | ada940f456e8a0083f8d5f034ff79a5c43c871a2 /monitor/main.c | |
parent | 566ef74749765ce5b3e4a8322fb59d56b20191a9 (diff) | |
download | bluez-4cd79c5a4042f0a682dd06da42f6377827293e5f.tar.gz |
monitor: Add support for reading btsnoop trace files
Diffstat (limited to 'monitor/main.c')
-rw-r--r-- | monitor/main.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/monitor/main.c b/monitor/main.c index ff7cc2d77..4cb281dc6 100644 --- a/monitor/main.c +++ b/monitor/main.c @@ -52,12 +52,14 @@ static void usage(void) "Usage:\n"); printf("\tbtmon [options]\n"); printf("options:\n" + "\t-r, --read <file> Read traces in btsnoop format\n" "\t-w, --write <file> Save traces in btsnoop format\n" "\t-s, --server <socket> Start monitor server socket\n" "\t-h, --help Show help options\n"); } static const struct option main_options[] = { + { "read", required_argument, NULL, 'r' }, { "write", required_argument, NULL, 'b' }, { "server", required_argument, NULL, 'r' }, { "version", no_argument, NULL, 'v' }, @@ -68,6 +70,7 @@ static const struct option main_options[] = { int main(int argc, char *argv[]) { unsigned long filter_mask = 0; + const char *reader_path = NULL; sigset_t mask; mainloop_init(); @@ -75,13 +78,16 @@ int main(int argc, char *argv[]) for (;;) { int opt; - opt = getopt_long(argc, argv, "w:s:vh", main_options, NULL); + opt = getopt_long(argc, argv, "r:w:s:vh", main_options, NULL); if (opt < 0) break; switch (opt) { + case 'r': + reader_path = optarg; + break; case 'w': - btsnoop_open(optarg); + btsnoop_create(optarg); break; case 's': control_server(optarg); @@ -111,6 +117,11 @@ int main(int argc, char *argv[]) printf("Bluetooth monitor ver %s\n", VERSION); + if (reader_path) { + control_reader(reader_path); + return EXIT_SUCCESS; + } + if (control_tracing() < 0) { if (hcidump_tracing() < 0) return EXIT_FAILURE; |