mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-28 08:37:22 +00:00
hci_transport_h4: use HCI_OUTGOING_PRE_BUFFER_SIZE
This commit is contained in:
parent
04c626e393
commit
8888c76903
@ -207,11 +207,20 @@ static int h4_send_packet(uint8_t packet_type, uint8_t * packet, int size){
|
||||
if (hci_transport_h4->uart_fd == 0) return -1;
|
||||
|
||||
char *data = (char*) packet;
|
||||
int bytes_written = write(hci_transport_h4->uart_fd, &packet_type, 1);
|
||||
int bytes_written;
|
||||
#if HCI_OUTGOING_PRE_BUFFER_SIZE > 0
|
||||
// just store packet type before actual data and increase size
|
||||
size++;
|
||||
data--;
|
||||
*data = packet_type;
|
||||
#else
|
||||
// write out single byte
|
||||
bytes_written = write(hci_transport_h4->uart_fd, &packet_type, 1);
|
||||
while (bytes_written < 1) {
|
||||
usleep(5000);
|
||||
bytes_written = write(hci_transport_h4->uart_fd, &packet_type, 1);
|
||||
};
|
||||
#endif
|
||||
while (size > 0) {
|
||||
bytes_written = write(hci_transport_h4->uart_fd, data, size);
|
||||
if (bytes_written < 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user