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
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 @@
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 @@
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 @@
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