usb: bluetooth: Fix assert due to unreserved headroom

Bluetooth net buffers have 1-byte reserve, which can be used by HCI bus
driver (uart, spi...) to set packet type (H4).
This fixes assert when building hci_usb with CONFIG_NET_BUF_SIMPLE_LOG.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
This commit is contained in:
Loic Poulain 2018-05-30 12:01:30 +02:00 committed by Anas Nashif
parent 51fecf80d9
commit 00a6b4c5ae

View File

@ -142,10 +142,11 @@ static void bluetooth_bulk_out_callback(u8_t ep,
return;
}
usb_read(ep, net_buf_add(buf, len), len, NULL);
net_buf_reserve(buf, CONFIG_BT_HCI_RESERVE);
bt_buf_set_type(buf, BT_BUF_ACL_OUT);
usb_read(ep, net_buf_add(buf, len), len, NULL);
net_buf_put(&tx_queue, buf);
}
@ -167,6 +168,7 @@ static int bluetooth_class_handler(struct usb_setup_packet *setup,
return -ENOMEM;
}
net_buf_reserve(buf, CONFIG_BT_HCI_RESERVE);
bt_buf_set_type(buf, BT_BUF_CMD);
net_buf_add_mem(buf, *data, *len);