Skip to content

Commit 8874209

Browse files
committed
Address removal of BT_HCI_RAW_MODE_H4
1 parent ffa99f7 commit 8874209

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/utility/HCIVirtualTransportZephyr.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,28 @@ HCIVirtualTransportZephyrClass::~HCIVirtualTransportZephyrClass()
3232
}
3333

3434
extern "C" void set_public_address(struct k_fifo *rx_queue);
35+
extern "C" int bt_h4_vnd_setup(const struct device *dev);
36+
struct h4_config {
37+
const struct device *uart;
38+
k_thread_stack_t *rx_thread_stack;
39+
size_t rx_thread_stack_size;
40+
struct k_thread *rx_thread;
41+
};
42+
3543
int HCIVirtualTransportZephyrClass::begin()
3644
{
3745
bt_enable_raw(__rx_queue);
38-
//bt_hci_raw_set_mode(BT_HCI_RAW_MODE_PASSTHROUGH);
46+
#if defined(CONFIG_BT_HCI_SETUP)
47+
const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_bt_hci));
48+
if (!dev) {
49+
return 0;
50+
}
51+
const struct h4_config *cfg = (const struct h4_config *)dev->config;
52+
bt_h4_vnd_setup(cfg->uart);
53+
#else
3954
set_public_address(__rx_queue);
40-
bt_hci_raw_set_mode(BT_HCI_RAW_MODE_H4);
55+
#endif
56+
4157
rxbuf.clear();
4258
return 1;
4359
}
@@ -93,7 +109,7 @@ int HCIVirtualTransportZephyrClass::read()
93109

94110
size_t HCIVirtualTransportZephyrClass::write(const uint8_t* data, size_t length)
95111
{
96-
struct net_buf *__net_buf = bt_buf_get_tx(BT_BUF_H4, K_MSEC(10), data, length);
112+
struct net_buf *__net_buf = bt_buf_get_tx(bt_buf_type_from_h4(data[0], BT_BUF_OUT), K_FOREVER, &data[1], length - 1);
97113
if (__net_buf) {
98114
auto err = bt_send(__net_buf);
99115
if (err) {

0 commit comments

Comments
 (0)