echo command missing some characters when sending to serial port

We are developing driver kit for usb to serial.
we testing by connect two usb to serial devices together (rx of device 1 to tx of device 2 and vice versa).
open two terminal windows
one type
echo "hello" > /dev/SerialDevice1
one type
cat < /dev/SerialDevice2
on device 2 only receive "h" character.
we capture by usb analyzer on device 1 and see that, the echo call to send out "hello" then it immediately call to HwResetFIFO causing the device 1 abort remaining characters.
Code Block cpp
kern_return_t
IMPL(NullDriver, HwResetFIFO) {
uint8_t purgeMask = 0;
if (tx) {
purgeMask |= TX_CLR_MASK;
}
if (rx) {
purgeMask |= RX_CLR_MASK;
}
return ivars->provider->DeviceRequest(USBmakeOutbmRequestType,
CP210xRequests::PURGE,
purgeMask, ivars->interfaceNumber, 0,
nullptr, nullptr, 0);
}

what should we do in this case? in driver, should we wait for all characters in device 1 finish sending before calling purge command to clear all characters in device 1?
echo command missing some characters when sending to serial port
 
 
Q