Skip to content

Commit

Permalink
Use tcflush() instead fsync() for data synchronization
Browse files Browse the repository at this point in the history
  • Loading branch information
pldemone committed Dec 28, 2015
1 parent b893cb1 commit f16a7b1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/grf_radio_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,9 @@ int grf_radio_write(struct grf_radio *radio, const char *message, size_t len)
len -= count;
}

if (fsync(radio->fd))
if (tcflush(radio->fd, TCOFLUSH))
{
grf_logging_err("Calling fsync on %d failed: %s", radio->fd, strerror(errno));
grf_logging_err("Calling tcflush on %d failed: %s", radio->fd, strerror(errno));
return errno;
}

Expand All @@ -450,9 +450,9 @@ int grf_radio_write_ctrl(struct grf_radio *radio, char ctrl)
if (write(radio->fd, &ctrl, sizeof(char)) < 0)
return errno;

if (fsync(radio->fd))
if (tcflush(radio->fd, TCOFLUSH))
{
grf_logging_err("Calling fsync on %d failed: %s", radio->fd, strerror(errno));
grf_logging_err("Calling tcflush on %d failed: %s", radio->fd, strerror(errno));
return errno;
}

Expand Down

0 comments on commit f16a7b1

Please sign in to comment.