mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Fix sync output to serial port
Using fsync() on filedescriptors for serial ports can not be relied on. Add use of tcdrain() to make sure data has been written by the serial port before proceeding. This fixes a problem with tio sometimes not writing piped input data to the serial port before exiting which results in the pending writes being cancelled / flushed.
This commit is contained in:
parent
0cdd69940f
commit
de606d51ba
1 changed files with 2 additions and 0 deletions
|
|
@ -165,6 +165,7 @@ void tty_flush(int fd)
|
||||||
}
|
}
|
||||||
tty_buffer_count -= count;
|
tty_buffer_count -= count;
|
||||||
fsync(fd);
|
fsync(fd);
|
||||||
|
tcdrain(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset
|
// Reset
|
||||||
|
|
@ -206,6 +207,7 @@ ssize_t tty_write(int fd, const void *buffer, size_t count)
|
||||||
}
|
}
|
||||||
|
|
||||||
fsync(fd);
|
fsync(fd);
|
||||||
|
tcdrain(fd);
|
||||||
|
|
||||||
if (option.output_delay)
|
if (option.output_delay)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue