Diff markup
001 001
002 By default, with qemu version < 0.8.0 and with 002 By default, with qemu version < 0.8.0 and with the command line
003 qemu -monitor pty or -serial pty, local echo i 003 qemu -monitor pty or -serial pty, local echo is
004 enabled for the qemu side of the pty. This can 004 enabled for the qemu side of the pty. This can result in infinite
005 write/read loops and/or slowness of the simula 005 write/read loops and/or slowness of the simulation. Attached is a very
006 small patch (against today's cvs) solving the 006 small patch (against today's cvs) solving the problem. The 3 lines
007 adjusting the tty fields could be replaced by 007 adjusting the tty fields could be replaced by "cfmakeraw(&tty)" if
008 available on the host platform. 008 available on the host platform.
009 009
010 -- David Decotigny (Dec 9 2005) 010 -- David Decotigny (Dec 9 2005)
011 011
012 012
013 Index: vl.c 013 Index: vl.c
014 ============================================== 014 ===================================================================
015 RCS file: /cvsroot/qemu/qemu/vl.c,v 015 RCS file: /cvsroot/qemu/qemu/vl.c,v
016 retrieving revision 1.152 016 retrieving revision 1.152
017 diff -u -r1.152 vl.c 017 diff -u -r1.152 vl.c
018 --- vl.c 5 Dec 2005 20:31:52 -0000 018 --- vl.c 5 Dec 2005 20:31:52 -0000 1.152
019 +++ vl.c 9 Dec 2005 15:07:46 -0000 019 +++ vl.c 9 Dec 2005 15:07:46 -0000
020 @@ -1396,6 +1396,7 @@ 020 @@ -1396,6 +1396,7 @@
021 #if defined(__linux__) 021 #if defined(__linux__)
022 CharDriverState *qemu_chr_open_pty(void) 022 CharDriverState *qemu_chr_open_pty(void)
023 { 023 {
024 + struct termios tty; 024 + struct termios tty;
025 char slave_name[1024]; 025 char slave_name[1024];
026 int master_fd, slave_fd; 026 int master_fd, slave_fd;
027 027
028 @@ -1403,6 +1404,14 @@ 028 @@ -1403,6 +1404,14 @@
029 if (openpty(&master_fd, &slave_fd, slave_ 029 if (openpty(&master_fd, &slave_fd, slave_name, NULL, NULL) < 0) {
030 return NULL; 030 return NULL;
031 } 031 }
032 + 032 +
033 + /* Disabling local echo and line-buffered 033 + /* Disabling local echo and line-buffered output */
034 + tcgetattr (master_fd, &tty); 034 + tcgetattr (master_fd, &tty);
035 + tty.c_lflag &= ~(ECHO|ICANON|ISIG); 035 + tty.c_lflag &= ~(ECHO|ICANON|ISIG);
036 + tty.c_cc[VMIN] = 1; 036 + tty.c_cc[VMIN] = 1;
037 + tty.c_cc[VTIME] = 0; 037 + tty.c_cc[VTIME] = 0;
038 + tcsetattr (master_fd, TCSAFLUSH, &tty); 038 + tcsetattr (master_fd, TCSAFLUSH, &tty);
039 + 039 +
040 fprintf(stderr, "char device redirected t 040 fprintf(stderr, "char device redirected to %s\n", slave_name);
041 return qemu_chr_open_fd(master_fd, master 041 return qemu_chr_open_fd(master_fd, master_fd);
042 } 042 }