From 75edff29b2c0157a15ad7fd565cab9ae94f7292f Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 10 Dec 2024 04:40:22 +0100 Subject: system: retrieve the serial console's baud rate at boot Calling agetty without any speed on the boot console tends to turn it to 9600 bauds by default. Let's try to get the device speed at boot before it's modified, in order to explicitly set the correct speed before modifying inittab. --- sbin/init.d/system | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sbin/init.d/system b/sbin/init.d/system index e5c9cd4..3041891 100755 --- a/sbin/init.d/system +++ b/sbin/init.d/system @@ -129,6 +129,17 @@ function update_consoles { chmod 620 "${path}" fi + # get the boot baud rate if none was set, or default to 115200 + if [ -n "${name##*:*}" ]; then + # try to get baud rate at boot + baud=$(stty /dev/null + if [ -n "$baud" ]; then + name=${name}:$baud + else + name=${name}:115200 + fi + fi + ser_consoles=( "${ser_consoles[@]}" "$name" ) fi done -- 2.17.5