From e9d67091bd978149ad795ffc55acbb584b88c35f Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 20 Aug 2013 16:37:41 -0700 Subject: [PATCH] monitor: Add stub for handling vendor events --- Makefile.tools | 1 + monitor/packet.c | 10 ++++++++-- monitor/vendor.c | 35 +++++++++++++++++++++++++++++++++++ monitor/vendor.h | 27 +++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 monitor/vendor.c create mode 100644 monitor/vendor.h diff --git a/Makefile.tools b/Makefile.tools index 4bcb18e39..f7fbc4030 100644 --- a/Makefile.tools +++ b/Makefile.tools @@ -20,6 +20,7 @@ monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \ monitor/btsnoop.h monitor/btsnoop.c \ monitor/control.h monitor/control.c \ monitor/packet.h monitor/packet.c \ + monitor/vendor.h monitor/vendor.c \ monitor/l2cap.h monitor/l2cap.c \ monitor/uuid.h monitor/uuid.c \ monitor/sdp.h monitor/sdp.c diff --git a/monitor/packet.c b/monitor/packet.c index 1330638ff..cda7e52ec 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -46,6 +46,7 @@ #include "uuid.h" #include "l2cap.h" #include "control.h" +#include "vendor.h" #include "packet.h" #define COLOR_INDEX_LABEL COLOR_WHITE @@ -5204,6 +5205,11 @@ static void le_meta_event_evt(const void *data, uint8_t size) subevent_data->func(data + 1, size - 1); } +static void vendor_evt(const void *data, uint8_t size) +{ + vendor_event(0xffff, data, size); +} + struct event_data { uint8_t event; const char *str; @@ -5346,8 +5352,8 @@ static const struct event_data event_table[] = { short_range_mode_change_evt, 3, true }, { 0x4d, "AMP Status Change", amp_status_change_evt, 2, true }, - { 0xfe, "Testing" }, - { 0xff, "Vendor" }, + { 0xfe, "Testing" }, + { 0xff, "Vendor", vendor_evt, 0, false }, { } }; diff --git a/monitor/vendor.c b/monitor/vendor.c new file mode 100644 index 000000000..31d48ee65 --- /dev/null +++ b/monitor/vendor.c @@ -0,0 +1,35 @@ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2011-2012 Intel Corporation + * Copyright (C) 2004-2010 Marcel Holtmann + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "packet.h" +#include "vendor.h" + +void vendor_event(uint16_t manufacturer, const void *data, uint8_t size) +{ + packet_hexdump(data, size); +} diff --git a/monitor/vendor.h b/monitor/vendor.h new file mode 100644 index 000000000..7dbd284f9 --- /dev/null +++ b/monitor/vendor.h @@ -0,0 +1,27 @@ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2011-2012 Intel Corporation + * Copyright (C) 2004-2010 Marcel Holtmann + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include + +void vendor_event(uint16_t manufacturer, const void *data, uint8_t size); -- 2.47.3