summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2014-11-21 09:03:00 +0100
committerKarel Zak2014-11-21 09:03:00 +0100
commit914047b498a377944699b59ec93deddd4de9d63d (patch)
tree447fd2c6637f7b2e29460971e68ba00100245d25
parentagetty: don't ignore TERM (diff)
downloadkernel-qcow2-util-linux-914047b498a377944699b59ec93deddd4de9d63d.tar.gz
kernel-qcow2-util-linux-914047b498a377944699b59ec93deddd4de9d63d.tar.xz
kernel-qcow2-util-linux-914047b498a377944699b59ec93deddd4de9d63d.zip
agetty: keep the current baud before try 9600 on serial lines
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--term-utils/agetty.86
-rw-r--r--term-utils/agetty.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/term-utils/agetty.8 b/term-utils/agetty.8
index 4ef1e6b8c..12e481f6c 100644
--- a/term-utils/agetty.8
+++ b/term-utils/agetty.8
@@ -70,8 +70,10 @@ the list, which is treated as if it were circular.
Baud rates should be specified in descending order, so that the
null character (Ctrl\-@) can also be used for baud-rate switching.
.sp
-This argument is optional and unnecessary for virtual terminals.
-The default for serial terminals is '9600'.
+This argument is optional and unnecessary for \fBvirtual terminals\fP.
+.sp
+The default for \fBserial terminals\fP is keep the current baud rate
+(see \fB\-\-keep-baud\fP) and if unsuccessful then default to '9600'.
.TP
term
The value to be used for the TERM environment variable. This overrides
diff --git a/term-utils/agetty.c b/term-utils/agetty.c
index 5181de150..34ad7f230 100644
--- a/term-utils/agetty.c
+++ b/term-utils/agetty.c
@@ -387,9 +387,11 @@ int main(int argc, char **argv)
tcsetpgrp(STDIN_FILENO, getpid());
- /* Default serial line speed (may be ignored on --{extract,keep}-baud) */
- if ((options.flags & F_VCONSOLE) == 0 && options.numspeed == 0)
+ /* Default is to follow the current line speend and then default to 9600 */
+ if ((options.flags & F_VCONSOLE) == 0 && options.numspeed == 0) {
options.speeds[options.numspeed++] = bcode("9600");
+ options.flags |= F_KEEPSPEED
+ }
/* Initialize the termios settings (raw mode, eight-bit, blocking i/o). */
debug("calling termio_init\n");