commit | 30ea6385df2d7c6db6954d41555d667d509ba873 | [log] [tgz] |
---|---|---|
author | Andrew Jeffery <andrew@aj.id.au> | Wed May 03 16:56:10 2023 +0930 |
committer | Andrew Jeffery <andrew@aj.id.au> | Tue May 09 22:28:16 2023 +0930 |
tree | dc38d9ea47bc756f5a8650eccf1aed122d21196a | |
parent | d769eecf1c0edc47f86c9325e03275d876dbc05d [diff] |
console-server: Add PTY support for testing purposes Different TTY device types have different configuration options. The existing code kinda smooshes the differences between UARTs and VUARTs together. PTYs do not require the configuration applicable to either UARTs or VUARTs. Given this, separate out and be explict about the concepts and configuration required for all three types. This in turn, with some further patches, allows testing of obmc-console using `socat`: https://amboar.github.io/notes/2023/05/02/testing-obmc-console-with-socat.html Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I3c1ce610132fce8ef6b5324ed3b4e0c86395e433
To build this project, run the following shell commands:
meson setup build meson compile -C build
To test:
meson test -C build
Running the server requires a serial port (e.g. /dev/ttyS0):
touch obmc-console.conf ./obmc-console-server --config obmc-console.conf ttyS0
To connect to the server, simply run the client:
./obmc-console-client
To disconnect the client, use the standard ~.
combination.
This shows how the host UART connection is abstracted within the BMC as a Unix domain socket.
+--------------------------------------------------------------------------------------------+ | | | obmc-console-client unix domain socket obmc-console-server | | | | +---------------------+ +------------------------+ | | | client.2200.conf | +---------------------+ | server.ttyVUART0.conf | | +---+--+ +---------------------+ | | +------------------------+ +--------+-------+ Network | 2200 +--> +->+ @obmc-console.host0 +<-+ <--+ /dev/ttyVUART0 | UARTs +---+--+ | socket-id = "host0" | | | | socket-id = "host0" | +--------+-------+ | | | +---------------------+ | | | | +---------------------+ +------------------------+ | | | | | | | +--------------------------------------------------------------------------------------------+
This supports multiple independent consoles. The socket-id is a unique portion for the unix domain socket created by the obmc-console-server instance. The server needs to know this because it needs to know what to name the pipe; the client needs to know it as it needs to form the abstract socket name to which to connect.