OSDN Git Service

monitor: Move btsnoop file creating into control handling
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 23 Aug 2013 17:58:52 +0000 (10:58 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 23 Aug 2013 17:58:52 +0000 (10:58 -0700)
monitor/control.c
monitor/control.h
monitor/main.c

index 288228e..a5567d0 100644 (file)
@@ -806,6 +806,11 @@ void control_server(const char *path)
        server_fd = fd;
 }
 
+void control_writer(const char *path)
+{
+       btsnoop_create(path, BTSNOOP_TYPE_EXTENDED_PHY);
+}
+
 void control_reader(const char *path)
 {
        unsigned char buf[MAX_PACKET_SIZE];
index 2d7d625..8781bd0 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <stdint.h>
 
+void control_writer(const char *path);
 void control_reader(const char *path);
 void control_server(const char *path);
 int control_tracing(void);
index 85e618d..0a2e8aa 100644 (file)
@@ -35,7 +35,6 @@
 #include "mainloop.h"
 #include "packet.h"
 #include "control.h"
-#include "btsnoop.h"
 
 static void signal_callback(int signum, void *user_data)
 {
@@ -79,7 +78,7 @@ static const struct option main_options[] = {
 int main(int argc, char *argv[])
 {
        unsigned long filter_mask = 0;
-       const char *str, *reader_path = NULL;
+       const char *str, *reader_path = NULL, *writer_path = NULL;
        sigset_t mask;
 
        mainloop_init();
@@ -99,7 +98,7 @@ int main(int argc, char *argv[])
                        reader_path = optarg;
                        break;
                case 'w':
-                       btsnoop_create(optarg, BTSNOOP_TYPE_EXTENDED_HCI);
+                       writer_path = optarg;
                        break;
                case 's':
                        control_server(optarg);
@@ -153,6 +152,9 @@ int main(int argc, char *argv[])
                return EXIT_SUCCESS;
        }
 
+       if (writer_path)
+               control_writer(writer_path);
+
        if (control_tracing() < 0)
                return EXIT_FAILURE;