summaryrefslogtreecommitdiffstats
path: root/scripts/serial
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-12-16 16:49:18 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-01-18 09:25:50 +0100
commit06fc3557c94c2b9d43bcfab72f4a024c7860be64 (patch)
tree98b16908f2ff0691191746104c459ca582ede1ee /scripts/serial
parent80caf8ac4300c36f21479f38699ac665082d9b39 (diff)
downloadbarebox-06fc3557c94c2b9d43bcfab72f4a024c7860be64.tar.gz
barebox-06fc3557c94c2b9d43bcfab72f4a024c7860be64.tar.xz
pyserial: decrease timeouts
pyserial has very generous timeouts which introduces quite big latencies at least when used on rfc2217 ports. Decrease timeouts to make it more reactive. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts/serial')
-rw-r--r--scripts/serial/rfc2217.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/serial/rfc2217.py b/scripts/serial/rfc2217.py
index 4fe1a72f19..b65edd55c8 100644
--- a/scripts/serial/rfc2217.py
+++ b/scripts/serial/rfc2217.py
@@ -341,9 +341,9 @@ class TelnetSubnegotiation(object):
"""
timeout_time = time.time() + timeout
while time.time() < timeout_time:
- time.sleep(0.05) # prevent 100% CPU load
if self.isReady():
break
+ time.sleep(0.001) # prevent 100% CPU load
else:
raise SerialException("timeout while waiting for option %r" % (self.name))
@@ -443,9 +443,9 @@ class RFC2217Serial(SerialBase):
# now wait until important options are negotiated
timeout_time = time.time() + self._network_timeout
while time.time() < timeout_time:
- time.sleep(0.05) # prevent 100% CPU load
if sum(o.active for o in mandadory_options) == sum(o.state != INACTIVE for o in mandadory_options):
break
+ time.sleep(0.001) # prevent 100% CPU load
else:
raise SerialException("Remote does not seem to support RFC2217 or BINARY mode %r" % mandadory_options)
if self.logger:
@@ -488,9 +488,9 @@ class RFC2217Serial(SerialBase):
self.logger.debug("Negotiating settings: %s" % (items,))
timeout_time = time.time() + self._network_timeout
while time.time() < timeout_time:
- time.sleep(0.05) # prevent 100% CPU load
if sum(o.active for o in items) == len(items):
break
+ time.sleep(0.001) # prevent 100% CPU load
else:
raise SerialException("Remote does not accept parameter change (RFC2217): %r" % items)
if self.logger:
@@ -865,13 +865,13 @@ class RFC2217Serial(SerialBase):
self.rfc2217SendSubnegotiation(NOTIFY_MODEMSTATE)
timeout_time = time.time() + self._network_timeout
while time.time() < timeout_time:
- time.sleep(0.05) # prevent 100% CPU load
# when expiration time is updated, it means that there is a new
# value
if self._modemstate_expires > time.time():
if self.logger:
self.logger.warning('poll for modem state failed')
break
+ time.sleep(0.001) # prevent 100% CPU load
# even when there is a timeout, do not generate an error just
# return the last known value. this way we can support buggy
# servers that do not respond to polls, but send automatic