diff options
author | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2011-08-05 02:18:16 +0000 |
---|---|---|
committer | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2011-08-05 02:18:16 +0000 |
commit | 5035eb1265e6622ec525c4b093dc4ae657632bce (patch) | |
tree | d0daa116d20165dfc36f7298f54bc68d66b20812 | |
parent | dba192101727a7f8fce958b62b3da16c9c798d61 (diff) | |
download | pyserial-5035eb1265e6622ec525c4b093dc4ae657632bce.tar.gz |
accepted patch SF 3316943
git-svn-id: http://svn.code.sf.net/p/pyserial/code/trunk/pyserial@404 f19166aa-fa4f-0410-85c2-fa1106f25c8a
-rw-r--r-- | CHANGES.txt | 4 | ||||
-rw-r--r-- | serial/serialposix.py | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index b50e4a8..f08f961 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -414,6 +414,10 @@ Bugfixes: - [SF 3093882] calling open() on an already open port now raises an exception - [SF 3245627] connection-lost let rfc2217 hangs in closed loop +Bugfixes (posix): + +- [SF 3316943] Avoid unneeded termios.tcsetattr calls in serialposix.py + Bugfixes (win32): - [SF 3057499] writeTimeoutError when write Timeout is 0 diff --git a/serial/serialposix.py b/serial/serialposix.py index ea3b760..7ff5ff6 100644 --- a/serial/serialposix.py +++ b/serial/serialposix.py @@ -305,7 +305,8 @@ class PosixSerial(SerialBase): vmin = 1 vtime = int(self._interCharTimeout * 10) try: - iflag, oflag, cflag, lflag, ispeed, ospeed, cc = termios.tcgetattr(self.fd) + orig_attr = termios.tcgetattr(self.fd) + iflag, oflag, cflag, lflag, ispeed, ospeed, cc = orig_attr except termios.error, msg: # if a port is nonexistent but has a /dev file, it'll fail here raise SerialException("Could not configure port: %s" % msg) # set up raw mode / no echo / binary @@ -408,7 +409,8 @@ class PosixSerial(SerialBase): raise ValueError('Invalid vtime: %r' % vtime) cc[TERMIOS.VTIME] = vtime # activate settings - termios.tcsetattr(self.fd, TERMIOS.TCSANOW, [iflag, oflag, cflag, lflag, ispeed, ospeed, cc]) + if [iflag, oflag, cflag, lflag, ispeed, ospeed, cc] != orig_attr: + termios.tcsetattr(self.fd, TERMIOS.TCSANOW, [iflag, oflag, cflag, lflag, ispeed, ospeed, cc]) # apply custom baud rate, if any if custom_baud is not None: |