When compiling for Linux, I just exclude these two fields and the serial port still works fine. Linux however does have the XTABS field which seems to be related. tty.c_oflag &= ~ONOEOT // Prevent removal of C-d chars (0x004) in output (NOT PRESENT IN LINUX)īoth OXTABS and ONOEOT are not defined in Linux. tty.c_oflag &= ~OXTABS // Prevent conversion of tabs to spaces (NOT PRESENT IN LINUX) Tty.c_oflag &= ~ONLCR // Prevent conversion of newline to carriage return/line feed Tty.c_oflag &= ~OPOST // Prevent special interpretation of output bytes (e.g. /dev/ttyUSB0 - Most USB-to-serial cables will show up using a file named like this.These are less common these days with newer desktops and laptops not having actual COM ports. /dev/ttyS0 - Standard COM ports will have this name./dev/ttyPS0 - Xilinx Zynq FPGAs running a Yocto-based Linux build will use this name for the default serial port that Getty connects to.Arduino UNOs (and similar) will appear using this name. /dev/ttyACM0 - ACM stands for the ACM modem on the USB bus.
These files usually pop-up in /dev/, and begin with the name tty*. In typical UNIX style, serial ports are represented by files within the operating system.
This page is an attempt to help explain these settings and show you how to configure a serial port in Linux correctly. When dealing with the termios.h header, there are many finicky settings buried within multiple bytes worth of bitfields. Unluckily, using serial ports in Linux is not the easiest thing in the world.