When a serial device responds to received data, there is always a delay before it will be seen on the host. Imagine what typically happens:
- The host sends some data (a string here). The sending may be performed in the background so that the write function returns while the data are still on the line.
- The client recives the data and stores it usually inside a buffer.
- Once the client detects the end of the command (probably the carriage return in your example), it decodes the command and sends an answer back.
With 8N1, each byte requires 10 / baud rate seconds to be transferred. Multiply this with the number of bytes send and received and add the command processing time of the client to know when the complete answer might be available.
There are two methods to check for available data: Polling and signal functions.
With polling, you will call the read function inside a loop until the return value indicates that data are available.
With signal functions, you will be get informed when new data are available. These will be typically used with threads. See the github example for your library at
https://github.com/mik3y/usb-serial-for-android/blob/master/usbSerialExamples/src/main/java/src/com/hoho/android/usbserial/examples/SerialConsoleActivity.java[
^].