summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Liechti <cliechti@gmx.net>2016-05-07 23:35:54 +0200
committerChris Liechti <cliechti@gmx.net>2016-05-07 23:35:54 +0200
commitf7534c8198d787cd11a943fd720d0edb8497f8d3 (patch)
treeda78c7fadf1b38f2cf18dc4079191ac6fab21b4a
parent19688bf72d963cd74e7f9ce846c804eafd3ba181 (diff)
downloadpyserial-git-f7534c8198d787cd11a943fd720d0edb8497f8d3.tar.gz
revert "fixes for RTS/DTR handling on open", bad solution
- with the patch, control lines have wrong initial state on posix - makes no difference on win32, execpt add code
-rw-r--r--serial/serialposix.py18
-rw-r--r--serial/serialutil.py4
-rw-r--r--serial/serialwin32.py5
3 files changed, 10 insertions, 17 deletions
diff --git a/serial/serialposix.py b/serial/serialposix.py
index f5fc43a..67a3fd4 100644
--- a/serial/serialposix.py
+++ b/serial/serialposix.py
@@ -551,19 +551,17 @@ class Serial(SerialBase, PlatformSpecific):
def _update_rts_state(self):
"""Set terminal status line: Request To Send"""
- if self._rts_state is not None:
- if self._rts_state:
- fcntl.ioctl(self.fd, TIOCMBIS, TIOCM_RTS_str)
- else:
- fcntl.ioctl(self.fd, TIOCMBIC, TIOCM_RTS_str)
+ if self._rts_state:
+ fcntl.ioctl(self.fd, TIOCMBIS, TIOCM_RTS_str)
+ else:
+ fcntl.ioctl(self.fd, TIOCMBIC, TIOCM_RTS_str)
def _update_dtr_state(self):
"""Set terminal status line: Data Terminal Ready"""
- if self._dtr_state is not None:
- if self._dtr_state:
- fcntl.ioctl(self.fd, TIOCMBIS, TIOCM_DTR_str)
- else:
- fcntl.ioctl(self.fd, TIOCMBIC, TIOCM_DTR_str)
+ if self._dtr_state:
+ fcntl.ioctl(self.fd, TIOCMBIS, TIOCM_DTR_str)
+ else:
+ fcntl.ioctl(self.fd, TIOCMBIC, TIOCM_DTR_str)
@property
def cts(self):
diff --git a/serial/serialutil.py b/serial/serialutil.py
index 80416ea..05ebd87 100644
--- a/serial/serialutil.py
+++ b/serial/serialutil.py
@@ -154,8 +154,8 @@ class SerialBase(io.RawIOBase):
self._dsrdtr = None
self._inter_byte_timeout = None
self._rs485_mode = None # disabled by default
- self._rts_state = None
- self._dtr_state = None
+ self._rts_state = True
+ self._dtr_state = True
self._break_state = False
# assign values using get/set methods using the properties feature
diff --git a/serial/serialwin32.py b/serial/serialwin32.py
index 1611e21..b843ac7 100644
--- a/serial/serialwin32.py
+++ b/serial/serialwin32.py
@@ -39,11 +39,6 @@ class Serial(SerialBase):
raise SerialException("Port must be configured before it can be used.")
if self.is_open:
raise SerialException("Port is already open.")
- # if RTS and/or DTR are not set before open, they default to True
- if self._rts_state is None:
- self._rts_state = True
- if self._dtr_state is None:
- self._dtr_state = True
# the "\\.\COMx" format is required for devices other than COM1-COM8
# not all versions of windows seem to support this properly
# so that the first few ports are used with the DOS device name