summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.tools1
-rw-r--r--monitor/msft.c69
-rw-r--r--monitor/msft.h31
-rw-r--r--monitor/packet.c54
4 files changed, 144 insertions, 11 deletions
diff --git a/Makefile.tools b/Makefile.tools
index d5fdf2d89..9543949a2 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -44,6 +44,7 @@ monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \
monitor/analyze.h monitor/analyze.c \
monitor/intel.h monitor/intel.c \
monitor/broadcom.h monitor/broadcom.c \
+ monitor/msft.h monitor/msft.c \
monitor/jlink.h monitor/jlink.c \
monitor/tty.h
monitor_btmon_LDADD = lib/libbluetooth-internal.la \
diff --git a/monitor/msft.c b/monitor/msft.c
new file mode 100644
index 000000000..e9a15d265
--- /dev/null
+++ b/monitor/msft.c
@@ -0,0 +1,69 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2011-2014 Intel Corporation
+ * Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <inttypes.h>
+
+#include "display.h"
+#include "packet.h"
+#include "vendor.h"
+#include "msft.h"
+
+static void msft_cmd(const void *data, uint8_t size)
+{
+ packet_hexdump(data, size);
+}
+
+static void msft_rsp(const void *data, uint8_t size)
+{
+ packet_hexdump(data, size);
+}
+
+static const struct vendor_ocf vendor_ocf_entry = {
+ 0x000, "Extension", msft_cmd, 1, false, msft_rsp, 1, false
+};
+
+const struct vendor_ocf *msft_vendor_ocf(void)
+{
+ return &vendor_ocf_entry;
+}
+
+static void msft_evt(const void *data, uint8_t size)
+{
+ packet_hexdump(data, size);
+}
+
+static const struct vendor_evt vendor_evt_entry = {
+ 0x00, "Extension", msft_evt, 1, false
+};
+
+const struct vendor_evt *msft_vendor_evt(void)
+{
+ return &vendor_evt_entry;
+}
diff --git a/monitor/msft.h b/monitor/msft.h
new file mode 100644
index 000000000..a268f4bc7
--- /dev/null
+++ b/monitor/msft.h
@@ -0,0 +1,31 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2011-2014 Intel Corporation
+ * Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include <stdint.h>
+
+struct vendor_ocf;
+struct vendor_evt;
+
+const struct vendor_ocf *msft_vendor_ocf(void);
+const struct vendor_evt *msft_vendor_evt(void);
diff --git a/monitor/packet.c b/monitor/packet.c
index 66af9b3dd..0c98fd766 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -41,6 +41,7 @@
#include "l2cap.h"
#include "control.h"
#include "vendor.h"
+#include "msft.h"
#include "intel.h"
#include "broadcom.h"
#include "packet.h"
@@ -3977,13 +3978,23 @@ void packet_monitor(struct timeval *tv, struct ucred *cred,
memcpy(index_list[index].bdaddr, ii->bdaddr, 6);
index_list[index].manufacturer = manufacturer;
- if (manufacturer == 2) {
+ switch (manufacturer) {
+ case 2:
/*
- * All Intel controllers that support the
+ * Intel controllers that support the
* Microsoft vendor extension are using
* 0xFC1E for VsMsftOpCode.
*/
index_list[index].msft_opcode = 0xFC1E;
+ break;
+ case 93:
+ /*
+ * Realtek controllers that support the
+ * Microsoft vendor extenions are using
+ * 0xFCF0 for VsMsftOpCode.
+ */
+ index_list[index].msft_opcode = 0xFCF0;
+ break;
}
}
@@ -9291,18 +9302,26 @@ static const char *get_supported_command(int bit)
static const char *current_vendor_str(void)
{
- uint16_t manufacturer;
+ uint16_t manufacturer, msft_opcode;
- if (index_current < MAX_INDEX)
+ if (index_current < MAX_INDEX) {
manufacturer = index_list[index_current].manufacturer;
- else
+ msft_opcode = index_list[index_current].msft_opcode;
+ } else {
manufacturer = fallback_manufacturer;
+ msft_opcode = BT_HCI_CMD_NOP;
+ }
+
+ if (msft_opcode != BT_HCI_CMD_NOP)
+ return "Microsoft";
switch (manufacturer) {
case 2:
return "Intel";
case 15:
return "Broadcom";
+ case 93:
+ return "Realtek";
}
return NULL;
@@ -9310,12 +9329,19 @@ static const char *current_vendor_str(void)
static const struct vendor_ocf *current_vendor_ocf(uint16_t ocf)
{
- uint16_t manufacturer;
+ uint16_t manufacturer, msft_opcode;
- if (index_current < MAX_INDEX)
+ if (index_current < MAX_INDEX) {
manufacturer = index_list[index_current].manufacturer;
- else
+ msft_opcode = index_list[index_current].msft_opcode;
+ } else {
manufacturer = fallback_manufacturer;
+ msft_opcode = BT_HCI_CMD_NOP;
+ }
+
+ if (msft_opcode != BT_HCI_CMD_NOP &&
+ cmd_opcode_ocf(msft_opcode) == ocf)
+ return msft_vendor_ocf();
switch (manufacturer) {
case 2:
@@ -9329,12 +9355,18 @@ static const struct vendor_ocf *current_vendor_ocf(uint16_t ocf)
static const struct vendor_evt *current_vendor_evt(uint8_t evt)
{
- uint16_t manufacturer;
+ uint16_t manufacturer, msft_opcode;
- if (index_current < MAX_INDEX)
+ if (index_current < MAX_INDEX) {
manufacturer = index_list[index_current].manufacturer;
- else
+ msft_opcode = index_list[index_current].msft_opcode;
+ } else {
manufacturer = fallback_manufacturer;
+ msft_opcode = BT_HCI_CMD_NOP;
+ }
+
+ if (msft_opcode != BT_HCI_CMD_NOP)
+ return NULL;
switch (manufacturer) {
case 2: