summaryrefslogtreecommitdiff
path: root/serial/serialposix.py
diff options
context:
space:
mode:
authorChris Liechti <cliechti@gmx.net>2016-01-21 23:57:02 +0100
committerChris Liechti <cliechti@gmx.net>2016-01-21 23:57:02 +0100
commit4cf6539532e2c87b8bb1f70c4d8d74916ee65734 (patch)
tree4529630b564aad497b0af5abdf151bf0accf737d /serial/serialposix.py
parent78143f97bf9b499a95736da36ad762e882f05a37 (diff)
downloadpyserial-git-4cf6539532e2c87b8bb1f70c4d8d74916ee65734.tar.gz
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)
Diffstat (limited to 'serial/serialposix.py')
-rw-r--r--serial/serialposix.py18
1 files changed, 10 insertions, 8 deletions
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 @@ class Serial(SerialBase, PlatformSpecific):
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):