Using serial ports for binary protocols on UN*X/Linux

It's been a very long time since I've actually been touching any application code using serial RS-232 ports on Linux or similar OS's. If I think more about it, it's probably about a decade now.

So in the last couple of days I was starting a program called bs11-config, a small command line tool for initial configuration of the BS-11 GSM BTS, part of the OpenBSC project.

The longest part of that program was actually not the code for the program itself, but rather finding out how to properly configure the serial port in a way that it really is completely raw, i.e. doesn't meddle with any of the rx or tx bytes in any possible way. It's always amazing how baroque some of the traditional UN*X interfaces are - particularly something like serial ports which traditionally have only been used to transport ASCII characters to serial (hardware) terminals, modems or similar equipment.

In any case, it's now working just fine. No more need for any proprietary 16bit windows programs such as LMT (local maintenance terminal) for doing the initial configuration of a BS-11. What a relief.

What I found incredibly useful was the Serial Programming Guide for POSIX Operating Systems. Thanks, Mike!