When using half-duplex communication (e.g. only a single wire for both Tx and Rx) a data packet needs to be transmitted entirely before attempting to switch into receiving mode. For legacy serial hardware, the tcdrain() probably works as advertised, and waits until the data has been transmitted. However for common usb-serial converters, the hardware doesn't provide any feedback to the driver, and the tcdrain() function can only wait until the data has been transmitted to the usb-serial chip. There is no guarantee that the data has actually been transmitted by the usb-serial chip. As a workaround, we wait at least the minimum amount of time required to transmit the data packet over a serial line, taking into account the current configuration.
Description
No description provided
Languages
C
98.3%
M4
1.2%
Makefile
0.5%