History log of /openbmc/obmc-console/tty-handler.c (Results 1 – 17 of 17)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1e04f449 12-Jun-2024 Alexander Hansen <alexander.hansen@9elements.com>

use iniparser dependency for config file parsing

For the config file, we do not need the custom handwritten parser.

Thanks to Andrew for this command, we can now search for an alternative

$ git gr

use iniparser dependency for config file parsing

For the config file, we do not need the custom handwritten parser.

Thanks to Andrew for this command, we can now search for an alternative

$ git grep -lw INI -- :/:*.bb
meta-openembedded/meta-oe/recipes-support/inih/libinih_58.bb
meta-openembedded/meta-oe/recipes-support/iniparser/iniparser_4.1.bb
meta-openembedded/meta-oe/recipes-support/minini/minini_1.2.b.bb
poky/meta/recipes-devtools/python/python3-iniconfig_2.0.0.bb
poky/meta/recipes-devtools/python/python3-iniparse_0.5.bb

For the ini parser we have following requirements

- small API
- easy to use
- compiles fast
- has tests, examples, docs
- support for sections

- minini [1]

can be dropped from the list since it also supports colon
':' instead of '=' for separating key and value, creating 2 ways of
doing something. This makes it harder to swap out the ini parser in
the future.

- libinih [2]

uses SAX-style parsing of .ini files and thus does not provide
a DOM of the .ini. This is a break from the previous parser which
stored everything in struct config. To use this library would require
to create a struct to store all the possible configuration, then fill
that struct in one pass. Essentially wrapping that library to have
DOM capability. That would be possible, but not ideal. libinih is also
highly configurable with lots of config options.

- iniparser [3]

has all the required features and stores the results of its
parsing for later use. It is a seamless upgrade from the previous
parser. The call sites do not have to be modified and we can read the
config as before. A downside is that we have to provide our own wrap
file.

For our purposes, iniparser is a good choice.

Using this dependency allows us to drop the custom parser and all the
tests that go along with it.

If sections are required in future config files, iniparser can also
support that.

References:

[1] https://github.com/compuphase/minIni
[2] https://github.com/benhoyt/inih
[3] https://gitlab.com/iniparser/iniparser

Change-Id: Ie2b57171ec1f8cb6b1b80ca1d9e6c112bedc1195
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>

show more ...


# e2826c7d 04-Jul-2024 Jeremy Kerr <jk@codeconstruct.com.au>

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 f

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>

show more ...


Revision tags: v1.1.0
# b70f8713 18-Apr-2023 Andrew Jeffery <andrew@aj.id.au>

obmc-console: Fix readability-isolate-declaration

For example:

```
/usr/bin/clang-tidy -checks=-*, readability-isolate-declaration -export-fixes /tmp/tmpoo7fbs72/tmpo8xiwfxs.yaml -p=build /mnt/host

obmc-console: Fix readability-isolate-declaration

For example:

```
/usr/bin/clang-tidy -checks=-*, readability-isolate-declaration -export-fixes /tmp/tmpoo7fbs72/tmpo8xiwfxs.yaml -p=build /mnt/host/andrew/home/andrew/src/openbmc/obmc-console/test/test-client-escape.c
/mnt/host/andrew/home/andrew/src/openbmc/obmc-console/build/../config.c:61:2: error: multiple declarations in a single statement reduces readability [readability-isolate-declaration,-warnings-as-errors]
char *name, *value;
^~~~~~~~~~~~~~~~~~~
/mnt/host/andrew/home/andrew/src/openbmc/obmc-console/build/../config.c:62:2: error: multiple declarations in a single statement reduces readability [readability-isolate-declaration,-warnings-as-errors]
char *p, *line;
^~~~~~~~~~~~~~~
/mnt/host/andrew/home/andrew/src/openbmc/obmc-console/build/../config.c:110:2: error: multiple declarations in a single statement reduces readability [readability-isolate-declaration,-warnings-as-errors]
size_t size, len;
^~~~~~~~~~~~~~~~~
/mnt/host/andrew/home/andrew/src/openbmc/obmc-console/build/../config.c:170:2: error: multiple declarations in a single statement reduces readability [readability-isolate-declaration,-warnings-as-errors]
struct config_item *item, *next;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/host/andrew/home/andrew/src/openbmc/obmc-console/build/../console-client.c:263:2: error: multiple declarations in a single statement reduces readability [readability-isolate-declaration,-warnings-as-errors]
struct console_client _client, *client;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 warnings generated.
```

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ia7829b1672ea2dfb3fa020c7c48bd8266e6a1769

show more ...


# 2834c5b1 18-Apr-2023 Andrew Jeffery <andrew@aj.id.au>

obmc-console: Fix readability-braces-around-statements

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I88d2bdcb15106298d83a1cf7176e069092820f1d


# 19c74d58 18-Apr-2023 Andrew Jeffery <andrew@aj.id.au>

obmc-console: Extract definition of _GNU_SOURCE

Avoid triggering bugprone-reserved-identifier

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I8b4d40c92c1e9633bdb078c3f8d6d97ffb248cc2


# a72711af 18-Apr-2023 Andrew Jeffery <andrew@aj.id.au>

obmc-console: Add clang-format configuration

And apply the formatting.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I75251051affa5129c8698185baf8d151302b19d6


# 1cecc5de 28-Feb-2019 Johnathan Mantey <johnathanx.mantey@intel.com>

Eliminate excessive CPU consumption when redirecting UART over SSH

Redirecting the external UART via SSH caused the console-server,
console-client, and dropbear to consume ~30% of the available CPU

Eliminate excessive CPU consumption when redirecting UART over SSH

Redirecting the external UART via SSH caused the console-server,
console-client, and dropbear to consume ~30% of the available CPU each
when a large amount of data was being written to the UART output.

Buffering all of the small 16550 FIFO bytes into a larger packet and
then sending that to the SSH SW allows more efficient transmission
over the ethernet connection.

Tested this by "ssh root@<bmc.ip.addr> -p 2200" on a system running a
CentOS distribution. Using a BASH console run a large binary file
through "od -t x1 <fname>" to create a large amount of traffic. At
the BMC console run "top" to review the CPU usage. My experience is
after this change is applied:
console-server: ~25% CPU
dropbear: ~3% CPU
console-client: ~1% CPU

Change-Id: Ibabfd285e97a487e7ff040e1cb3159fbff360328
Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com>

show more ...


# f9c8f6ca 04-Mar-2019 Cheng C Yang <cheng.c.yang@linux.intel.com>

Change baudrate dynamically through dbus

Create a dbus interface so that user can change baudrate dynamically.
With this feature, SOL can still work correctly when BIOS switch uart
from high speed u

Change baudrate dynamically through dbus

Create a dbus interface so that user can change baudrate dynamically.
With this feature, SOL can still work correctly when BIOS switch uart
from high speed uart to normal uart.

Tested By:
Run busctl introspect xyz.openbmc_project.console /xyz/openbmc_project/console
the property baudrate show the current baudrate.
Run busctl call xyz.openbmc_project.console /xyz/openbmc_project/console
xyz.openbmc_project.console setBaudRate x 9600
The property baudrate show 9600 now. After change BIOS console redirection
to 9600 baudrate and change putty client also to 9600. SOL and serial port can
work correctly.

Change-Id: I2045f47520275a0b5bb9242af78a64e5aac8ea8a
Signed-off-by: Cheng C Yang <cheng.c.yang@linux.intel.com>

show more ...


# fcbdea9c 04-Jun-2018 Benjamin Fair <benjaminfair@google.com>

tty-handler: move baud rate parsing into config.c

This is in preparation for being able to set the baud rate on the host
console tty.

Change-Id: Id279530bdfc1240649fcdd606fbc928437fc38dc
Signed-off

tty-handler: move baud rate parsing into config.c

This is in preparation for being able to set the baud rate on the host
console tty.

Change-Id: Id279530bdfc1240649fcdd606fbc928437fc38dc
Signed-off-by: Benjamin Fair <benjaminfair@google.com>

show more ...


# 67eab046 11-Jul-2017 Jeremy Kerr <jk@ozlabs.org>

tty-handler: unify error handling for poller failures

We currently have a bug where we don't unregister from the ringbuffer
poller if we get an error on read(). This change unifies the
error-handlin

tty-handler: unify error handling for poller failures

We currently have a bug where we don't unregister from the ringbuffer
poller if we get an error on read(). This change unifies the
error-handling for potential failure cases in the poller handler, and
ensures that we unregister the ringbuffer poller and console poller in
all cases.

Change-Id: If354dd3c7f2a1ec534c6b42020fd9978e53cb20d
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

show more ...


# 6b1fed27 07-Feb-2017 Jeremy Kerr <jk@ozlabs.org>

server: improve blocked-write behaviour for handlers

We currently don't implement POLLOUT properly; we never set this for
polled events, and will repeat calls to write() if we see EAGAIN.

This chan

server: improve blocked-write behaviour for handlers

We currently don't implement POLLOUT properly; we never set this for
polled events, and will repeat calls to write() if we see EAGAIN.

This change improves the behaviour when writes start to block, by
tracking when a fd is blocked. Once we detect blocking behaviour, we
supress future (non-forced) writes, and wait for POLLOUT so we know when
we can write again.

Change-Id: I809bde4e1c7c78a58ea296d5c076b3d93c272558
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

show more ...


# f733c85a 07-Feb-2017 Jeremy Kerr <jk@ozlabs.org>

server: use ringbuffer for all handlers

Currently, we use the a ringbuffer within the socket handler to manage
bursts of data to slower clients.

However, we're also seeing cases where the local tty

server: use ringbuffer for all handlers

Currently, we use the a ringbuffer within the socket handler to manage
bursts of data to slower clients.

However, we're also seeing cases where the local tty handler becomes
blocking as well. So, we want to implement a buffer within the tty
handler too.

This change moves the ringbuffer 'up a layer' - from the socket handler
to the core console code.

We remove the ->data_in callback from handlers, and work on the
assumption that handlers have registered their own consumer on the
console's ringbuffer (through a new helper function,
console_ringbuffer_consumer_register()).

Change-Id: Ie8f02d6632578c50bb5e2dfb9bee6ece86432135
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

show more ...


# 55c9712d 07-Feb-2017 Jeremy Kerr <jk@ozlabs.org>

server: Use consistent function names

Put verbs at the end, ie:
console_register_poller -> console_poller_register
console_register_handler -> console_handler_register

Change-Id: I4fa78137ce54a3f

server: Use consistent function names

Put verbs at the end, ie:
console_register_poller -> console_poller_register
console_register_handler -> console_handler_register

Change-Id: I4fa78137ce54a3f15aad87c3371569b084e47094
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

show more ...


# bc506fd2 06-Feb-2017 Jeremy Kerr <jk@ozlabs.org>

tty-handler: use simpler open in non-blocking mode

Currently, we're opening the tty file descriptor in blocking mode, then
switching to non-blocking mode with fcntl(F_SETFL, F_NDELAY);

[and F_NDELA

tty-handler: use simpler open in non-blocking mode

Currently, we're opening the tty file descriptor in blocking mode, then
switching to non-blocking mode with fcntl(F_SETFL, F_NDELAY);

[and F_NDELAY == O_NDELAY == O_NONBLOCK ]

This change just opens with O_NONBLOCK instead.

Change-Id: I414ebec632008d65dec87d956d5a0ac1a46ec837
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

show more ...


# 81408bd0 18-Apr-2017 Xo Wang <xow@google.com>

tty-handler: Use raw byte handling for terminal

When opening the tty for local UART mirroring, disable various special
processing of terminal input and output like flow control, line edit
(canonical

tty-handler: Use raw byte handling for terminal

When opening the tty for local UART mirroring, disable various special
processing of terminal input and output like flow control, line edit
(canonical) mode, character translation, special characters, etc.

This forwards all terminal input to the VUART and allow the host OS to
perform any necessary processing.

Change-Id: I8b2896e7465c8af643f0cbbcaf7ef2f9ee96e2f5
Signed-off-by: Xo Wang <xow@google.com>

show more ...


# c5ef8ead 17-Apr-2017 Xo Wang <xow@google.com>

tty-handler: Add baud rate setting

Add local-tty-baud setting for configuration file.
Optionally change tty baud rate using termios.

For errors, use prints to stderr where warn/error calls are not

tty-handler: Add baud rate setting

Add local-tty-baud setting for configuration file.
Optionally change tty baud rate using termios.

For errors, use prints to stderr where warn/error calls are not
appropriate (i.e. errno hasn't been set by the error-causing call).

Fixes openbmc/openbmc#992.

Change-Id: Ia9226d1666f2626b2c04f30297755d93aee4994e
Signed-off-by: Xo Wang <xow@google.com>

show more ...


# bc1e8933 27-Apr-2016 Jeremy Kerr <jk@ozlabs.org>

tty: Add handler for local tty mirroring

This change adds a simple handler for mirroring data to local tty
device, like a hardware UART.

This is specified through a new config parameter 'local-tty'

tty: Add handler for local tty mirroring

This change adds a simple handler for mirroring data to local tty
device, like a hardware UART.

This is specified through a new config parameter 'local-tty'.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

show more ...