From 393f37dbfcae858e38aa119fb32a61ae3239c57d Mon Sep 17 00:00:00 2001 From: Georgios Karnas Date: Tue, 5 May 2020 14:57:42 -0700 Subject: [PATCH] avrsim: update avrsim pty attr (#2343) Signed-off-by: Georgios Karnas --- scripts/avrsim.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/avrsim.py b/scripts/avrsim.py index a48aeee7..bbf97e87 100755 --- a/scripts/avrsim.py +++ b/scripts/avrsim.py @@ -150,9 +150,19 @@ def create_pty(ptyname): os.symlink(os.ttyname(sfd), ptyname) fcntl.fcntl(mfd, fcntl.F_SETFL , fcntl.fcntl(mfd, fcntl.F_GETFL) | os.O_NONBLOCK) - old = termios.tcgetattr(mfd) - old[3] = old[3] & ~termios.ECHO - termios.tcsetattr(mfd, termios.TCSADRAIN, old) + tcattr = termios.tcgetattr(mfd) + tcattr[0] &= ~( + termios.IGNBRK | termios.BRKINT | termios.PARMRK | termios.ISTRIP | + termios.INLCR | termios.IGNCR | termios.ICRNL | termios.IXON) + tcattr[1] &= ~termios.OPOST + tcattr[3] &= ~( + termios.ECHO | termios.ECHONL | termios.ICANON | termios.ISIG | + termios.IEXTEN) + tcattr[2] &= ~(termios.CSIZE | termios.PARENB) + tcattr[2] |= termios.CS8 + tcattr[6][termios.VMIN] = 0 + tcattr[6][termios.VTIME] = 0 + termios.tcsetattr(mfd, termios.TCSAFLUSH, tcattr) return mfd def main():