Add Connect() method to console DBUS object

Added new poller and consumer for the console DBUS data.

Note: We initially developed SocketName attribute but it is now
      deprecated/removed.

The tree of default object:
$ busctl tree xyz.openbmc_project.Console.default
`-/xyz
  `-/xyz/openbmc_project
    `-/xyz/openbmc_project/console
      `-/xyz/openbmc_project/console/default

The introspect of default console:
$ busctl introspect xyz.openbmc_project.Console.default /xyz/openbmc_project/console/default
NAME                                TYPE      SIGNATURE RESULT/VALUE FLAGS
org.freedesktop.DBus.Introspectable interface -         -            -
.Introspect                         method    -         s            -
org.freedesktop.DBus.Peer           interface -         -            -
.GetMachineId                       method    -         s            -
.Ping                               method    -         -            -
org.freedesktop.DBus.Properties     interface -         -            -
.Get                                method    ss        v            -
.GetAll                             method    s         a{sv}        -
.Set                                method    ssv       -            -
.PropertiesChanged                  signal    sa{sv}as  -            -
xyz.openbmc_project.Console.Access  interface -         -            -
.Connect                            method    -         h            -
xyz.openbmc_project.console         interface -         -            -
.setBaudRate                        method    u         x            -
.baudrate                           property  u         0            -

Tested:
  Performed integration testing with bmcweb.

Change-Id: I2444b1083cf26536f43c6f6b4b0857a2921c4f78
Signed-off-by: Ninad Palsule <ninadpalsule@us.ibm.com>
4 files changed
tree: ca4203b34e4b7d089d70bfc298a3f11285575290
  1. conf/
  2. test/
  3. .clang-format
  4. .clang-tidy
  5. .gitignore
  6. .travis.yml
  7. CHANGELOG.md
  8. config.c
  9. console-client.c
  10. console-dbus.c
  11. console-server.c
  12. console-server.h
  13. console-socket.c
  14. LICENSE
  15. log-handler.c
  16. meson.build
  17. meson_options.txt
  18. OWNERS
  19. README.md
  20. ringbuffer.c
  21. socket-handler.c
  22. tty-handler.c
  23. util.c
README.md

To Build

To build this project, run the following shell commands:

meson setup build
meson compile -C build

To test:

meson test -C build

To Run Server

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 Client

To connect to the server, simply run the client:

./obmc-console-client

To disconnect the client, use the standard ~. combination.

Underlying design

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.