Serial port dropping bytes

view story

https://bbs.archlinux.org – Looks like the bytes sent were 13 04 06 so the 13 got eaten somewhere.  As hex 13 is XOFF, I tried running stty -F /dev/ttyUSB0 -ixon .  This seems to have solved the issue.  As I had no idea where to start when I wrote the serial interface originally, I looked at gtkterm for how to set up a serial port.  It turns out that I forgot to initialize the c_iflag field of the termios struct for the port.  After initializing that field to sensible defaults, the problem seems to be solved.  Although I suppose I now have a nice technique for simulating a lossy connection: (HowTos)