summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2016-04-22 14:42:59 +0300
committerJohan Hedberg <johan.hedberg@intel.com>2016-04-22 18:49:11 +0300
commit4488fc6cabb989ec081198389706657b6b15fe5c (patch)
tree805c85f0312d4f06b36054aa63ceff7c5336445f
parent8c3add2b6abeec5df20b6311bdbdbe16542cb582 (diff)
Bluetooth: Move HCI device bus information to the driver
The bus that we notify over the monitor protocol is really driver specific, so let each driver specify their bus type. Change-Id: Ic3a086fcc06352dbf051e52cef5bf6b8696349ae Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r--drivers/bluetooth/h4.c1
-rw-r--r--drivers/bluetooth/h5.c1
-rw-r--r--include/bluetooth/driver.h13
-rw-r--r--net/bluetooth/hci_core.c2
-rw-r--r--net/bluetooth/monitor.h8
-rw-r--r--tests/bluetooth/test_bluetooth/src/bluetooth.c1
6 files changed, 17 insertions, 9 deletions
diff --git a/drivers/bluetooth/h4.c b/drivers/bluetooth/h4.c
index 0c75a5b42..a5bc16f3b 100644
--- a/drivers/bluetooth/h4.c
+++ b/drivers/bluetooth/h4.c
@@ -254,6 +254,7 @@ static int h4_open(void)
}
static struct bt_driver drv = {
+ .bus = BT_DRIVER_BUS_UART,
.open = h4_open,
.send = h4_send,
};
diff --git a/drivers/bluetooth/h5.c b/drivers/bluetooth/h5.c
index c627e43d4..33c44200e 100644
--- a/drivers/bluetooth/h5.c
+++ b/drivers/bluetooth/h5.c
@@ -764,6 +764,7 @@ static int h5_open(void)
}
static struct bt_driver drv = {
+ .bus = BT_DRIVER_BUS_UART,
.open = h5_open,
.send = h5_queue,
};
diff --git a/include/bluetooth/driver.h b/include/bluetooth/driver.h
index 56820d866..331a9153a 100644
--- a/include/bluetooth/driver.h
+++ b/include/bluetooth/driver.h
@@ -52,7 +52,20 @@ struct net_buf *bt_buf_get_acl(void);
/* Receive data from the controller/HCI driver */
int bt_recv(struct net_buf *buf);
+enum bt_driver_bus {
+ BT_DRIVER_BUS_VIRTUAL = 0,
+ BT_DRIVER_BUS_USB = 1,
+ BT_DRIVER_BUS_PCCARD = 2,
+ BT_DRIVER_BUS_UART = 3,
+ BT_DRIVER_BUS_RS232 = 4,
+ BT_DRIVER_BUS_PCI = 5,
+ BT_DRIVER_BUS_SDIO = 6,
+};
+
struct bt_driver {
+ /* Bus of the transport (BT_DRIVER_BUS_*) */
+ enum bt_driver_bus bus;
+
/* Open the HCI transport */
int (*open)(void);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 3078a01fa..4ca58069d 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3095,7 +3095,7 @@ int bt_driver_register(struct bt_driver *drv)
bt_dev.drv = drv;
- bt_monitor_new_index(BT_MONITOR_TYPE_PRIMARY, BT_MONITOR_BUS_UART,
+ bt_monitor_new_index(BT_MONITOR_TYPE_PRIMARY, drv->bus,
BT_ADDR_ANY, "bt0");
return 0;
diff --git a/net/bluetooth/monitor.h b/net/bluetooth/monitor.h
index fa9c972f7..d56155fba 100644
--- a/net/bluetooth/monitor.h
+++ b/net/bluetooth/monitor.h
@@ -39,14 +39,6 @@
#define BT_MONITOR_TYPE_PRIMARY 0
#define BT_MONITOR_TYPE_AMP 1
-#define BT_MONITOR_BUS_VIRTUAL 0
-#define BT_MONITOR_BUS_USB 1
-#define BT_MONITOR_BUS_PCCARD 2
-#define BT_MONITOR_BUS_UART 3
-#define BT_MONITOR_BUS_RS232 4
-#define BT_MONITOR_BUS_PCI 5
-#define BT_MONITOR_BUS_SDIO 6
-
struct bt_monitor_hdr {
uint16_t opcode;
uint16_t index;
diff --git a/tests/bluetooth/test_bluetooth/src/bluetooth.c b/tests/bluetooth/test_bluetooth/src/bluetooth.c
index 77824dc02..0dd473152 100644
--- a/tests/bluetooth/test_bluetooth/src/bluetooth.c
+++ b/tests/bluetooth/test_bluetooth/src/bluetooth.c
@@ -40,6 +40,7 @@ static int driver_send(struct net_buf *buf)
}
static struct bt_driver drv = {
+ .bus = BT_DRIVER_BUS_VIRTUAL,
.open = driver_open,
.send = driver_send,
};