Skip to content

Commit

Permalink
serial: Fix the handling of timeout for when writing through serial
Browse files Browse the repository at this point in the history
A timeout happens when the number of written bytes is less than the requested number of bytes to be written.

Signed-off-by: Dan Nechita <[email protected]>
  • Loading branch information
dNechita committed Feb 26, 2021
1 parent 9d79757 commit 18eb623
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ static ssize_t serial_write_data(struct iio_context_pdata *pdata,

IIO_DEBUG("Write returned %li: %s\n", (long) ret, data);

if (ret == 0) {
if (ret < len) {
IIO_ERROR("sp_blocking_write has timedout");
return -ETIMEDOUT;
}
Expand Down

0 comments on commit 18eb623

Please sign in to comment.