[syslinux] [PATCH 1/1] COM32 libutil: Fix error in flags in console_ansi_std(void)
Gene Cumm
gene.cumm at gmail.com
Sun Feb 15 14:24:49 PST 2009
From: Gene Cumm <gene.cumm at gmail.com>
COM32 libutil: Fix error in flags in console_ansi_std(void)
ICANON and ECHO were applied to the control flags not local flags.
Signed-off-by: Gene Cumm <gene.cumm at gmail.com>
---
If ICANON or ECHO were applied to a serial port on Linux on the x86
architecture, this would change the serial ports baud rate.
>From my /usr/include/bits/termios.h (select in-order lines):
/* c_cflag bit meaning */
#define B150 0000005
#define B300 0000007
#define B9600 0000015
#define B38400 0000017
/* c_lflag bits */
#define ICANON 0000002
#define ECHO 0000010
The different baud rates are defined here. If someone set the baud
rate to 9600 and set ICANON on c_cflag, it should change the baud rate
to 38400, dropping communication. Another example is if someone set
the baud rate to 150 the set ICANON and ECHO on c_cflag, it should
change the baud to 38400. If I am interpreting the rest of the file
correctly, a bitmask covering all of the bits used in c_cflag for the
baud rate is 0010017.
diff --git a/com32/libutil/ansiline.c b/com32/libutil/ansiline.c
index 6ec1e18..4cf8021 100644
--- a/com32/libutil/ansiline.c
+++ b/com32/libutil/ansiline.c
@@ -82,7 +85,7 @@ void console_ansi_std(void)
tcgetattr(0, &tio);
tio.c_iflag &= ~ICRNL;
tio.c_iflag |= IGNCR;
- tio.c_cflag |= ICANON|ECHO;
+ tio.c_lflag |= ICANON|ECHO;
tcsetattr(0, TCSANOW, &tio);
fputs("\033[0m\033[20h", stdout);
}
More information about the Syslinux
mailing list