Skip to content

Commit 023f675

Browse files
committed
Avoid serial port write error for Windows,
1 parent 3220931 commit 023f675

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/serial_port.c

+3-8
Original file line numberDiff line numberDiff line change
@@ -304,17 +304,12 @@ int serial_port_write (MYFDTYPE fd, char *str, int len)
304304
{
305305
text_color_set(DW_COLOR_ERROR);
306306
dw_printf ("Error writing to serial port. Error %d.\n\n", err);
307+
return (-1);
307308
}
308309
}
309-
else if ((int)nwritten != len)
310-
{
311-
// Do we want this message here?
312-
// Or rely on caller to check and provide something more meaningful for the usage?
313-
//text_color_set(DW_COLOR_ERROR);
314-
//dw_printf ("Error writing to serial port. Only %d of %d written.\n\n", (int)nwritten, len);
315-
}
316310

317-
return (nwritten);
311+
// nwritten is 0 for asynchronous write, at this point, so just return the requested len.
312+
return (len);
318313

319314
#else
320315
int written;

0 commit comments

Comments
 (0)