OSDN Git Service

HCI HAL: Retry writing HCI data on UART socket for EAGAIN errors
authorLawrance Liu <lawrance.liu@mediatek.com>
Wed, 21 Sep 2016 15:01:13 +0000 (23:01 +0800)
committerAndre Eisenbach <eisenbach@google.com>
Fri, 14 Oct 2016 20:28:48 +0000 (20:28 +0000)
If HCI HAL receives error code "EAGAIN" when transmitting data on UART
socket, retry transmit data again.

Purpose :
When doing system suspend/resume aging test, the HCI HAL may transmit
data during system resuming. In this case, there exist some timing which
BT controller does not allow HCI HAL to transmit data.

Change-Id: Ic1f13c76d8e735c941800a318a0388ca42b1fd72
Test: System suspend/resume aging test.

hci/src/hci_hal_h4.c

index c8b3715..4febeb4 100644 (file)
@@ -162,6 +162,9 @@ static uint16_t transmit_data(serial_data_type_t type, uint8_t *data, uint16_t l
     OSI_NO_INTR(ret = write(uart_fd, data + transmitted_length, length));
     switch (ret) {
       case -1:
+        if (errno == EAGAIN)
+            continue;
+
         LOG_ERROR(LOG_TAG, "In %s, error writing to the uart serial port: %s", __func__, strerror(errno));
         goto done;
       case 0: