Dropped bytes from reads

A few posts ago I was having issues with commands not having all the bytes I was expecting. It was causing issues with sending commands as I would on occasion not get "command 1", it was causing issues with receiving commands as I would not get some parts of the command, most of the time "command 1". Generally it was being a HUGE PITA.

I posted a "hey why is it doing this?" message on the Smarthome forum to try and find out if there was something I was doing wrong, and forum user "LeeG" responded with a comment that made me revisit "SerialTransport". Turns out that this code that is at least 8 years old was not turning software flow control off, and 0x11 and 0x13 while used by Insteon as On and Off commands are also known as xon and xoff. With flow control left on, the Linux line discipline was interpreting them and removing them from the incoming character stream, explaining why I was not seeing them in the application.

Adding termp.c_iflag &= ~(IXON | IXOFF | IXANY); to the serial port setup ensures that all software flow control is turned off, and that the offending characters are sent to the application.

This has led to me being able to remove a lot of the special case handling of commands that are short by a byte, and it has helped my command receiving code enormously.