fixes for RTS/DTR handling on open (#59)
- internal RTS/DTR state defaults to None
- serialwin32 and serialcli platforms override that to True (as before)
- serialposix leaves it unset and therefore does not touch RTS/DTR on open
(as it was in pySerial 2.7 and before)
diff --git a/serial/serialposix.py b/serial/serialposix.py
index 3015bc9..5f54786 100644
--- a/serial/serialposix.py
+++ b/serial/serialposix.py
@@ -594,17 +594,19 @@
def _update_rts_state(self):
"""Set terminal status line: Request To Send"""
- 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 is not None:
+ 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:
- fcntl.ioctl(self.fd, TIOCMBIS, TIOCM_DTR_str)
- else:
- fcntl.ioctl(self.fd, TIOCMBIC, TIOCM_DTR_str)
+ 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)
@property
def cts(self):