commit | e2826c7def432a5c8f694ffb87355cb80862612b | [log] [tgz] |
---|---|---|
author | Jeremy Kerr <jk@codeconstruct.com.au> | Fri Jul 05 10:54:21 2024 +0800 |
committer | Jeremy Kerr <jk@codeconstruct.com.au> | Fri Jul 05 13:27:49 2024 +0800 |
tree | 99eae2aff8f5a268c828a82a48b5f6ce97c6dc68 | |
parent | a71b3954015c3f670ed102f05f451ae47b7025eb [diff] |
console-server: allow separate handler instances Currently, each handler (socket-handler, tty-handler and log-handler) provides a statically-allocated instance of a handler, which gets initialized for a console through the ->init callback. We have upcoming changes that may create more than one console object, in which case means we will need multiple instances of each handler type. This change splits the handler type from the handler instance; the former is now struct handler_type, with struct handler being the instance. Handler modules define a (const) struct handler_type, and ->init() now returns a newly-allocated instance of a handler of that type. This allows multiple handlers of each type. Because the handler instances are allocated by type->init, we now require both ->init and ->fini to be present on registered handlers. We no longer need the `bool active` member of the handler, as instances are always active. Change-Id: Id97f15bd6445e17786f5883b849de8559c5ea434 Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
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 +---+--+ | console-id = "host0" | | | | console-id = "host0" | +--------+-------+ | | | +---------------------+ | | | | +----------------------+ +------------------------+ | | | | | | | +---------------------------------------------------------------------------------------------+
This supports multiple independent consoles. The console-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.