Skip to content

Commit 08fc229

Browse files
committed
Merge branch 'topic/rfc2217_less_negotiations'
2 parents d656868 + c8b35f4 commit 08fc229

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

serial/rfc2217.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,15 @@ def set(self, value):
330330
the client needs to know if the change is performed he has to check the
331331
state of this object.
332332
"""
333-
self.value = value
334-
self.state = REQUESTED
335-
self.connection.rfc2217_send_subnegotiation(self.option, self.value)
336-
if self.connection.logger:
337-
self.connection.logger.debug("SB Requesting {} -> {!r}".format(self.name, self.value))
333+
if value != self.value:
334+
self.value = value
335+
self.state = REQUESTED
336+
self.connection.rfc2217_send_subnegotiation(self.option, self.value)
337+
if self.connection.logger:
338+
self.connection.logger.debug("SB Requesting {} -> {!r}".format(self.name, self.value))
339+
else:
340+
if self.connection.logger:
341+
self.connection.logger.debug("SB Requesting {} -> {!r} (skipped)".format(self.name, self.value))
338342

339343
def is_ready(self):
340344
"""\

0 commit comments

Comments
 (0)