[uart] Use tcdrain for flushing instead oftcflush on host (#14877)

Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
This commit is contained in:
puddly
2026-05-06 14:53:48 -04:00
committed by GitHub
parent 6173656bf8
commit 1e58e8729a

View File

@@ -276,9 +276,12 @@ UARTFlushResult HostUartComponent::flush() {
if (this->file_descriptor_ == -1) {
return UARTFlushResult::UART_FLUSH_RESULT_ASSUMED_SUCCESS;
}
tcflush(this->file_descriptor_, TCIOFLUSH);
ESP_LOGV(TAG, " Flushing");
return UARTFlushResult::UART_FLUSH_RESULT_ASSUMED_SUCCESS;
if (tcdrain(this->file_descriptor_) == -1) {
this->update_error_(strerror(errno));
return UARTFlushResult::UART_FLUSH_RESULT_FAILED;
}
return UARTFlushResult::UART_FLUSH_RESULT_SUCCESS;
}
void HostUartComponent::update_error_(const std::string &error) {