3 * BlueZ - Bluetooth protocol stack for Linux
5 * Copyright (C) 2011-2012 Intel Corporation
6 * Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
39 static void signal_callback(int signum, void *user_data)
49 static void usage(void)
51 printf("btmon - Bluetooth monitor\n"
53 printf("\tbtmon [options]\n");
55 "\t-b, --btsnoop <file> Save dump in btsnoop format\n"
56 "\t-h, --help Show help options\n");
59 static const struct option main_options[] = {
60 { "btsnoop", required_argument, NULL, 'b' },
61 { "version", no_argument, NULL, 'v' },
62 { "help", no_argument, NULL, 'h' },
66 int main(int argc, char *argv[])
68 unsigned long filter_mask = 0;
76 opt = getopt_long(argc, argv, "bvh", main_options, NULL);
85 printf("%s\n", VERSION);
96 sigaddset(&mask, SIGINT);
97 sigaddset(&mask, SIGTERM);
99 mainloop_set_signal(&mask, signal_callback, NULL, NULL);
101 filter_mask |= PACKET_FILTER_SHOW_INDEX;
102 filter_mask |= PACKET_FILTER_SHOW_TIME;
103 filter_mask |= PACKET_FILTER_SHOW_ACL_DATA;
105 packet_set_filter(filter_mask);
107 printf("Bluetooth monitor ver %s\n", VERSION);
109 if (control_tracing() < 0) {
110 if (hcidump_tracing() < 0)
114 return mainloop_run();