Softgun serial interface configuration

Backend Types

Serial interface connected to a file

A serial interface can be connected to a file. This might be stdin or a real UART. The file backend is the most used backend. Examples:
[usart2]
type: file
file: stdin
Be careful with stdin as uart file backend. Linux terminals like xterm or konsole typically use <NL> as line termination where most terminal programms like minicom and Hyperterminal use <CR><NL> as line termination. Many embedded applications are not prepared for a missing <CR>.
[uart6]
type: file
file: /dev/ttyUSB0 

The NULL UART

The NULL Uart module is the default backend. If a configuration section for an uart does not exist then the NULL Uart is selected. This backend eats up all data and emits nothing. It is also possible to configure the uart explicitly:
[uart5]
type: null

Serial interface connected to a Pseudo terminal

Softgun can create a pseudo terminal device using /dev/ptmx. You can use the pseudo terminal similar to a real serial interface. For example you can connect with minicom to the pseudo terminal. Because it is not known in advance what the name of the created device will be softgun can create a link to the device file. Example:
[uart0]
type: ptmx
link: /tmp/pty_myembeddedsystem

Nine or more bits

The ptmx interface is the only one which supports more than 8 Bits per character. Because a ptmx interface emits a stream of bytes the data need to be framed. softgun does this by encoding any data stream with more than eight bits as UTF8. This is of course a misuse of the UTF8 encoding, but it saves me from the need of writing a documentation. If you want to have UTF8 encoding even for 8 bits per character you can force UTF8 mode:
[uartXX]
type: ptmx
utf8: 1

Serial interface connected to a simulated device

You can create own serial interface backends in softgun. For example you might have a gyroscope with a serial interface. Write a backend called gyroscope which responds to serial queries like the real device, then connect softgun to this backend in the configuration file:
 
[uart5]
type: gyroscope