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>
diff --git a/console-server.h b/console-server.h
index d2ac87f..9bb12ba 100644
--- a/console-server.h
+++ b/console-server.h
@@ -18,6 +18,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <termios.h> /* for speed_t */
+#include <systemd/sd-bus.h>
struct console;
struct config;
@@ -44,6 +45,8 @@
struct console *console,
struct config *config);
void (*fini)(struct handler *handler);
+ int (*baudrate)(struct handler *handler,
+ speed_t baudrate);
bool active;
};
@@ -118,6 +121,8 @@
void config_fini(struct config *config);
int config_parse_baud(speed_t *speed, const char *baud_string);
+uint32_t parse_baud_to_int(speed_t speed);
+speed_t parse_int_to_baud(uint32_t baud);
int config_parse_logsize(const char *size_str, size_t *size);
/* socket paths */