I have written a Linux app to read & write binary data to a remote device over a USB port that is emulating a serial port.
When I read data from the device, I have a USB sniffer that shows a binary data stream like this (0x01, 0x0A......0x13), but when my program reads the bytes, the 0x13 is not in the byte stream - this is the XOFF char, but I am not using XON/XOFF flow control (I think).
Tried both open read and write, as well as fopen fread and fwrite in binary mode, same result. Any ideas?
Maybe it's better to avoid control characters being sent through serial port at all, and instead slightly modify app on Linux and remote device to encode/decode them into/from two bytes. For example:
Considering the probability of appearing of these 3 bytes in a binary stream this shouldn't decrease the overall throughput I think.
And by the way, XON/XOFF is a software flow control and basic function of serial/terminal drivers. Actually this function can be useful in your case too - to avoid buffers overflow and missing some valuable bytes you can pause (XOFF) or resume (XON) transmission.