AP_HAL_SITL: correct _unbuffered_writes usage

This commit is contained in:
Pierre Kancir 2017-11-30 15:12:57 +01:00 committed by Tom Pittenger
parent 6d472376bb
commit c30642a348
1 changed files with 6 additions and 1 deletions

View File

@ -160,7 +160,12 @@ size_t UARTDriver::write(const uint8_t *buffer, size_t size)
DataFlash_Class::instance()->Log_Write("SBUS", "TimeUS,ToD", "QQ", DataFlash_Class::instance()->Log_Write("SBUS", "TimeUS,ToD", "QQ",
AP_HAL::micros64(), time); AP_HAL::micros64(), time);
// write buffer straight to the file descriptor // write buffer straight to the file descriptor
::write(_fd, buffer, size); ssize_t nwritten = ::write(_fd, buffer, size);
if (nwritten == -1 && errno != EAGAIN && _uart_path) {
close(_fd);
_fd = -1;
_connected = false;
}
// these have no effect // these have no effect
tcdrain(_fd); tcdrain(_fd);
} else { } else {