pytty

changeset 13:dbe4867da9c5

Removed baud rate support check.
author Arc Riley <arcriley@gmail.com>
date Wed, 10 Nov 2010 15:23:45 -0500
parents 28f009bb22b7
children eeb751ade1ef
files src/__init__.py
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line diff
     1.1 --- a/src/__init__.py	Wed Nov 10 14:42:21 2010 -0500
     1.2 +++ b/src/__init__.py	Wed Nov 10 15:23:45 2010 -0500
     1.3 @@ -81,8 +81,6 @@
     1.4    @baud.setter
     1.5    def baud (self, value) :
     1.6      import termios
     1.7 -    tci = termios.tcgetattr(self._fdi)
     1.8 -    tco = termios.tcgetattr(self._fdo)
     1.9      try :
    1.10        tv = {
    1.11          0 : termios.B0,           50 : termios.B50,
    1.12 @@ -98,12 +96,11 @@
    1.13        }[value]
    1.14      except KeyError :
    1.15        raise IOError('Baud rate not supported by PyTTY.')
    1.16 -    if (tci[0] & tv) and (tci[1] & tv) and (tco[0] & tv) and (tco[1] & tv) :
    1.17 -      tci[4], tci[5], tco[4], tco[5] = (tv,)*4
    1.18 -      termios.tcsetattr(self._fdi, termios.TCSANOW, tci)
    1.19 -      termios.tcsetattr(self._fdo, termios.TCSANOW, tco)
    1.20 -    else :
    1.21 -      raise IOError('Baud rate not supported by TTY device.')
    1.22 +    tci = termios.tcgetattr(self._fdi)
    1.23 +    tco = termios.tcgetattr(self._fdo)
    1.24 +    tci[4], tci[5], tco[4], tco[5] = (tv,)*4
    1.25 +    termios.tcsetattr(self._fdi, termios.TCSANOW, tci)
    1.26 +    termios.tcsetattr(self._fdo, termios.TCSANOW, tco)
    1.27  
    1.28  
    1.29  # Clean up package namespace